@@ -34,14 +34,15 @@ try {
3434 await access ( installedEntry ) ;
3535 const port = await reservePort ( ) ;
3636
37- runtime = spawn ( process . execPath , [ installedEntry ] , {
37+ runtime = spawn ( bin , [ ] , {
3838 cwd : runtimeDir ,
3939 env : {
4040 ...process . env ,
4141 PORT : String ( port ) ,
4242 PROMPT_REFINER_BACKGROUND : "true" ,
4343 } ,
4444 stdio : [ "ignore" , "pipe" , "pipe" ] ,
45+ shell : process . platform === "win32" ,
4546 windowsHide : true ,
4647 } ) ;
4748
@@ -55,13 +56,24 @@ try {
5556 await waitForHealth ( port , ( ) => `${ stdout } \n${ stderr } ` , timeoutMs ) ;
5657 console . log ( `Package runtime smoke passed: installed ${ packed [ 0 ] . name } -${ packed [ 0 ] . version } and served /api/health on ${ port } .` ) ;
5758} finally {
58- if ( runtime && ! runtime . killed ) {
59- runtime . kill ( "SIGTERM" ) ;
60- await waitForClose ( runtime , 5_000 ) ;
61- }
59+ if ( runtime ) await terminateRuntime ( runtime , 5_000 ) ;
6260 await rm ( tempRoot , { recursive : true , force : true } ) ;
6361}
6462
63+ async function terminateRuntime ( child , timeoutMs ) {
64+ if ( child . exitCode !== null || child . signalCode !== null ) return ;
65+ if ( process . platform === "win32" && child . pid ) {
66+ const killer = spawn ( "taskkill" , [ "/pid" , String ( child . pid ) , "/t" , "/f" ] , {
67+ stdio : "ignore" ,
68+ windowsHide : true ,
69+ } ) ;
70+ await waitForClose ( killer , timeoutMs ) ;
71+ } else {
72+ child . kill ( "SIGTERM" ) ;
73+ }
74+ await waitForClose ( child , timeoutMs ) ;
75+ }
76+
6577async function waitForClose ( child , timeoutMs ) {
6678 if ( child . exitCode !== null || child . signalCode !== null ) return ;
6779 await Promise . race ( [
0 commit comments