@@ -678,7 +678,9 @@ export class ToolRunner extends events.EventEmitter {
678
678
if ( fileStream ) {
679
679
fileStream . write ( data ) ;
680
680
}
681
- cp . stdin ?. write ( data ) ;
681
+ if ( ! cp . stdin ?. destroyed ) {
682
+ cp . stdin ?. write ( data ) ;
683
+ }
682
684
} catch ( err ) {
683
685
this . _debug ( 'Failed to pipe output of ' + toolPathFirst + ' to ' + toolPath ) ;
684
686
this . _debug ( toolPath + ' might have exited due to errors prematurely. Verify the arguments passed are valid.' ) ;
@@ -1180,18 +1182,18 @@ export class ToolRunner extends events.EventEmitter {
1180
1182
state . CheckComplete ( ) ;
1181
1183
} ) ;
1182
1184
1183
- cp . on ( 'exit' , ( code : number , signal : any ) => {
1185
+ cp . on ( 'exit' , ( code : number , signal : number | NodeJS . Signals ) => {
1184
1186
state . processExitCode = code ;
1185
1187
state . processExited = true ;
1186
- this . _debug ( `Exit code ${ code } received from tool '${ this . toolPath } '` ) ;
1188
+ this . _debug ( `STDIO streams have closed and received exit code ${ code } and signal ${ signal } for tool '${ this . toolPath } '` ) ;
1187
1189
state . CheckComplete ( )
1188
1190
} ) ;
1189
1191
1190
- cp . on ( 'close' , ( code : number , signal : any ) => {
1192
+ cp . on ( 'close' , ( code : number , signal : number | NodeJS . Signals ) => {
1191
1193
state . processExitCode = code ;
1192
1194
state . processExited = true ;
1193
1195
state . processClosed = true ;
1194
- this . _debug ( `STDIO streams have closed for tool '${ this . toolPath } '` )
1196
+ this . _debug ( `STDIO streams have closed and received exit code ${ code } and signal ${ signal } for tool '${ this . toolPath } '` ) ;
1195
1197
state . CheckComplete ( ) ;
1196
1198
} ) ;
1197
1199
@@ -1312,18 +1314,18 @@ export class ToolRunner extends events.EventEmitter {
1312
1314
state . CheckComplete ( ) ;
1313
1315
} ) ;
1314
1316
1315
- cp . on ( 'exit' , ( code : number , signal : any ) => {
1317
+ cp . on ( 'exit' , ( code : number , signal : number | NodeJS . Signals ) => {
1316
1318
state . processExitCode = code ;
1317
1319
state . processExited = true ;
1318
- this . _debug ( `Exit code ${ code } received from tool '${ this . toolPath } '` ) ;
1320
+ this . _debug ( `STDIO streams have closed and received exit code ${ code } and signal ${ signal } for tool '${ this . toolPath } '` ) ;
1319
1321
state . CheckComplete ( )
1320
1322
} ) ;
1321
1323
1322
- cp . on ( 'close' , ( code : number , signal : any ) => {
1324
+ cp . on ( 'close' , ( code : number , signal : number | NodeJS . Signals ) => {
1323
1325
state . processExitCode = code ;
1324
1326
state . processExited = true ;
1325
1327
state . processClosed = true ;
1326
- this . _debug ( `STDIO streams have closed for tool '${ this . toolPath } '` )
1328
+ this . _debug ( `STDIO streams have closed and received exit code ${ code } and signal ${ signal } for tool '${ this . toolPath } '` ) ;
1327
1329
state . CheckComplete ( ) ;
1328
1330
} ) ;
1329
1331
@@ -1374,9 +1376,10 @@ export class ToolRunner extends events.EventEmitter {
1374
1376
* Used to close child process by sending SIGNINT signal.
1375
1377
* It allows executed script to have some additional logic on SIGINT, before exiting.
1376
1378
*/
1377
- public killChildProcess ( ) : void {
1379
+ public killChildProcess ( signal : number | NodeJS . Signals = "SIGTERM" ) : void {
1378
1380
if ( this . childProcess ) {
1379
- this . childProcess . kill ( ) ;
1381
+ this . _debug ( `[killChildProcess] Signal ${ signal } received` ) ;
1382
+ this . childProcess . kill ( signal ) ;
1380
1383
}
1381
1384
}
1382
1385
}
0 commit comments