@@ -53,10 +53,20 @@ function mergeChildEnv(params: {
5353} ) : NodeJS . ProcessEnv {
5454 const resolvedEnv : NodeJS . ProcessEnv = { } ;
5555 for ( const [ key , value ] of Object . entries ( params . baseEnv ) ) {
56- assignChildEnvValue ( { env : resolvedEnv , key, platform : params . platform , value } ) ;
56+ assignChildEnvValue ( {
57+ env : resolvedEnv ,
58+ key,
59+ platform : params . platform ,
60+ value,
61+ } ) ;
5762 }
5863 for ( const [ key , value ] of Object . entries ( params . env ?? { } ) ) {
59- assignChildEnvValue ( { env : resolvedEnv , key, platform : params . platform , value } ) ;
64+ assignChildEnvValue ( {
65+ env : resolvedEnv ,
66+ key,
67+ platform : params . platform ,
68+ value,
69+ } ) ;
6070 }
6171 return resolvedEnv ;
6272}
@@ -166,15 +176,23 @@ export async function runExec(
166176 encoding : "buffer" as const ,
167177 } ;
168178 try {
169- const invocation = resolveChildProcessInvocation ( { argv : [ command , ...args ] } ) ;
179+ const invocation = resolveChildProcessInvocation ( {
180+ argv : [ command , ...args ] ,
181+ } ) ;
170182 const { stdout, stderr } = ( await execFileAsync ( invocation . command , invocation . args , {
171183 ...options ,
172184 windowsHide : invocation . windowsHide ,
173185 windowsVerbatimArguments : invocation . windowsVerbatimArguments ,
174186 } ) ) as { stdout : Buffer ; stderr : Buffer } ;
175187 const windowsEncoding = resolveWindowsConsoleEncoding ( ) ;
176- const decodedStdout = decodeWindowsOutputBuffer ( { buffer : stdout , windowsEncoding } ) ;
177- const decodedStderr = decodeWindowsOutputBuffer ( { buffer : stderr , windowsEncoding } ) ;
188+ const decodedStdout = decodeWindowsOutputBuffer ( {
189+ buffer : stdout ,
190+ windowsEncoding,
191+ } ) ;
192+ const decodedStderr = decodeWindowsOutputBuffer ( {
193+ buffer : stderr ,
194+ windowsEncoding,
195+ } ) ;
178196 if ( shouldLogVerbose ( ) ) {
179197 if ( decodedStdout . trim ( ) ) {
180198 logDebug ( decodedStdout . trim ( ) ) ;
@@ -449,7 +467,10 @@ export async function runCommandWithTimeout(
449467 ...( killProcessTree && process . platform !== "win32" ? { detached : true } : { } ) ,
450468 windowsHide : invocation . windowsHide ,
451469 windowsVerbatimArguments : invocation . windowsVerbatimArguments ,
452- ...( shouldSpawnWithShell ( { resolvedCommand : invocation . command , platform : process . platform } )
470+ ...( shouldSpawnWithShell ( {
471+ resolvedCommand : invocation . command ,
472+ platform : process . platform ,
473+ } )
453474 ? { shell : true }
454475 : { } ) ,
455476 } ) ;
@@ -480,7 +501,10 @@ export async function runCommandWithTimeout(
480501 let noOutputTimedOut = false ;
481502 let killIssuedByTimeout = false ;
482503 let killIssuedByAbort = false ;
483- let childExitState : { code : number | null ; signal : NodeJS . Signals | null } | null = null ;
504+ let childExitState : {
505+ code : number | null ;
506+ signal : NodeJS . Signals | null ;
507+ } | null = null ;
484508 let closeFallbackTimer : NodeJS . Timeout | null = null ;
485509 let processTreeForceKillTimer : NodeJS . Timeout | null = null ;
486510 let noOutputTimer : NodeJS . Timeout | null = null ;
@@ -533,7 +557,7 @@ export async function runCommandWithTimeout(
533557 spawn ( taskkillPath , [ "/PID" , String ( child . pid ) , "/T" ] , {
534558 stdio : "ignore" ,
535559 windowsHide : true ,
536- } ) ;
560+ } ) . on ( "error" , ( ) => { } ) ;
537561 if ( ! processTreeForceKillTimer ) {
538562 processTreeForceKillTimer = setTimeout ( ( ) => {
539563 processTreeForceKillTimer = null ;
@@ -549,7 +573,7 @@ export async function runCommandWithTimeout(
549573 spawn ( taskkillPath , [ "/PID" , String ( child . pid ) , "/T" , "/F" ] , {
550574 stdio : "ignore" ,
551575 windowsHide : true ,
552- } ) ;
576+ } ) . on ( "error" , ( ) => { } ) ;
553577 } catch {
554578 child . kill ( "SIGKILL" ) ;
555579 }
@@ -561,7 +585,9 @@ export async function runCommandWithTimeout(
561585 // Fall through to Node's direct child kill as a last resort.
562586 }
563587 }
564- terminateProcessTree ( child . pid , { graceMs : COMMAND_PROCESS_TREE_KILL_GRACE_MS } ) ;
588+ terminateProcessTree ( child . pid , {
589+ graceMs : COMMAND_PROCESS_TREE_KILL_GRACE_MS ,
590+ } ) ;
565591 return ;
566592 }
567593 if ( process . platform === "win32" && typeof child . pid === "number" && child . pid > 0 ) {
@@ -573,7 +599,7 @@ export async function runCommandWithTimeout(
573599 stdio : "ignore" ,
574600 windowsHide : true ,
575601 } ,
576- ) ;
602+ ) . on ( "error" , ( ) => { } ) ;
577603 return ;
578604 } catch {
579605 // Fall through to Node's direct child kill as a last resort.
0 commit comments