@@ -227,7 +227,6 @@ async function runBundleCommand(
227227
228228 logger ?. debug ( quote ( [ cmd , ...args ] ) , { bundleOpName} ) ;
229229 const abortController = new AbortController ( ) ;
230- cancellationToken ?. onCancellationRequested ( ( ) => abortController . abort ( ) ) ;
231230 let options : SpawnOptionsWithoutStdio = {
232231 cwd : workspaceFolder . fsPath ,
233232 env : removeUndefinedKeys ( env ) ,
@@ -237,6 +236,15 @@ async function runBundleCommand(
237236 ( { cmd, args, options} = getEscapedCommandAndAgrs ( cmd , args , options ) ) ;
238237 try {
239238 const p = spawn ( cmd , args , options ) ;
239+ cancellationToken ?. onCancellationRequested ( ( ) => {
240+ if ( process . platform === "win32" && p . pid ) {
241+ // On windows aborting the signal doesn't kill the CLI.
242+ // Use taskkill here with the "force" and "tree" flags (to kill sub-processes too)
243+ spawn ( "taskkill" , [ "/pid" , String ( p . pid ) , "/T" , "/F" ] ) ;
244+ } else {
245+ abortController . abort ( ) ;
246+ }
247+ } ) ;
240248 const { stdout, stderr} = await waitForProcess ( p , onStdOut , onStdError ) ;
241249 logger ?. info ( displayLogs . end , {
242250 bundleOpName,
0 commit comments