@@ -13,18 +13,30 @@ export interface LernaPackageDescription {
13
13
location : string ;
14
14
}
15
15
16
- export function spawnSync ( command : string , args : string [ ] , options : SpawnSyncOptionsWithStringEncoding ) : SpawnSyncReturns < string > {
16
+ export function spawnSync ( command : string , args : string [ ] , options : SpawnSyncOptionsWithStringEncoding ) : SpawnSyncReturns < string > ;
17
+ export function spawnSync ( command : string , args : string [ ] , options : SpawnSyncOptionsWithStringEncoding , ignoreErrors : false ) : SpawnSyncReturns < string > ;
18
+ export function spawnSync ( command : string , args : string [ ] , options : SpawnSyncOptionsWithStringEncoding , ignoreErrors : true ) : SpawnSyncReturns < string > | undefined ;
19
+ export function spawnSync ( command : string , args : string [ ] , options : SpawnSyncOptionsWithStringEncoding , ignoreErrors = false ) : SpawnSyncReturns < string > | undefined {
17
20
const result = spawn . sync ( command , args , options ) ;
18
21
if ( result . error ) {
19
22
console . error ( 'spawn.sync returned error' , result . error ) ;
20
23
console . error ( result . stdout ) ;
21
24
console . error ( result . stderr ) ;
22
- throw new Error ( `Failed to spawn ${ command } , args: ${ args . join ( ',' ) } : ${ result . error } ` ) ;
25
+
26
+ if ( ! ignoreErrors ) {
27
+ throw new Error ( `Failed to spawn ${ command } , args: ${ args . join ( ',' ) } : ${ result . error } ` ) ;
28
+ } else {
29
+ console . warn ( 'Ignoring error and continuing...' ) ;
30
+ }
23
31
} else if ( result . status !== 0 ) {
24
32
console . error ( 'spawn.sync exited with non-zero' , result . status ) ;
25
33
console . error ( result . stdout ) ;
26
34
console . error ( result . stderr ) ;
27
- throw new Error ( `Spawn exited non-zero for ${ command } , args: ${ args . join ( ',' ) } : ${ result . status } ` ) ;
35
+ if ( ! ignoreErrors ) {
36
+ throw new Error ( `Spawn exited non-zero for ${ command } , args: ${ args . join ( ',' ) } : ${ result . status } ` ) ;
37
+ } else {
38
+ console . warn ( 'Ignoring error and continuing...' ) ;
39
+ }
28
40
}
29
41
return result ;
30
42
}
@@ -138,7 +150,7 @@ export function markBumpedFilesAsAssumeUnchanged(
138
150
stdio : 'inherit' ,
139
151
cwd : PROJECT_ROOT ,
140
152
encoding : 'utf8'
141
- } ) ;
153
+ } , true ) ;
142
154
console . info ( `File ${ f } is now ${ assumeUnchanged ? '' : 'NOT ' } assumed to be unchanged` ) ;
143
155
} ) ;
144
156
}
0 commit comments