Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions packages/nx/src/executors/run-commands/running-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,21 +359,15 @@ class RunningNodeProcess implements RunningTask {

kill(signal?: NodeJS.Signals): Promise<void> {
return new Promise<void>((res, rej) => {
if (process.platform === 'win32') {
if (this.childProcess.kill(signal)) {
res();
treeKill(this.childProcess.pid, signal, (err) => {
// On Windows, tree-kill (which uses taskkill) may fail when the process or its child process is already terminated.
// Ignore the errors, otherwise we will log them unnecessarily.
if (err && process.platform !== 'win32') {
rej(err);
} else {
rej('Unable to kill process');
res();
}
} else {
treeKill(this.childProcess.pid, signal, (err) => {
if (err) {
rej(err);
} else {
res();
}
});
}
});
});
}

Expand Down
Loading