File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,26 @@ class JavaCaller {
106106 let child ;
107107 let timeoutId ;
108108 let killedByTimeout = false ;
109+
110+ const wasKilledByTimeout = ( code , signal ) => {
111+ if ( ! runOptions . timeout ) {
112+ return false ;
113+ }
114+ if ( killedByTimeout ) {
115+ return true ;
116+ }
117+ if ( signal && signal === runOptions . killSignal ) {
118+ return true ;
119+ }
120+ const signals = os . constants && os . constants . signals ? os . constants . signals : { } ;
121+ if ( typeof runOptions . killSignal === "string" && signals [ runOptions . killSignal ] && code === 128 + signals [ runOptions . killSignal ] ) {
122+ return true ;
123+ }
124+ if ( typeof runOptions . killSignal === "number" && code === 128 + runOptions . killSignal ) {
125+ return true ;
126+ }
127+ return false ;
128+ } ;
109129 const prom = new Promise ( ( resolve ) => {
110130 // Spawn java command line
111131 debug ( `Java command: ${ javaExeToUse } ${ javaArgs . join ( " " ) } ` ) ;
@@ -161,7 +181,7 @@ class JavaCaller {
161181 clearTimeout ( timeoutId ) ;
162182 }
163183
164- if ( killedByTimeout || ( runOptions . timeout && signal === runOptions . killSignal ) ) {
184+ if ( wasKilledByTimeout ( code , signal ) ) {
165185 // Process was terminated because of the timeout, either via our fallback timer or the built-in spawn timeout
166186 this . status = 666 ;
167187 stderr += `Process timed out with ${ runOptions . killSignal } after ${ runOptions . timeout } ms.` ;
You can’t perform that action at this time.
0 commit comments