Skip to content

Commit

Permalink
fix(js): ignore watch errors when a process is already killed on Wind…
Browse files Browse the repository at this point in the history
…ows (#17891)

(cherry picked from commit 9bb60a7)
  • Loading branch information
jaysoo authored and FrozenPandaz committed Jun 30, 2023
1 parent 60e6c36 commit 38861fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/js/src/executors/node/lib/kill-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export async function killTree(pid: number, signal: NodeJS.Signals) {

switch (process.platform) {
case 'win32':
exec('taskkill /pid ' + pid + ' /T /F', callback);
exec('taskkill /pid ' + pid + ' /T /F', (error) => {
// Ignore Fatal errors (128) because it might be due to the process already being killed.
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
callback(error?.code !== 128 ? error : null);
});
break;
case 'darwin':
buildProcessTree(
Expand Down

0 comments on commit 38861fd

Please sign in to comment.