fix(core): use process#kill instead of tree-kill for windows and macos (#30976)
Prefer `process#kill` instead of `tree-kill` for Mac and Windows. This fixes an issue on Windows where the `taskkill` is unsuccessful. ## Current Behavior Windows does not always run successfully ## Expected Behavior Windows runs successfully ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
1029ecb9fd
commit
7b9add5582
@ -93,12 +93,20 @@ function startWebServer(webServerCommand: string) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new Promise<void>((res, rej) => {
|
return new Promise<void>((res, rej) => {
|
||||||
treeKill(serverProcess.pid, (err) => {
|
if (process.platform === 'win32' || process.platform === 'darwin') {
|
||||||
if (err) {
|
if (this.childProcess.kill()) {
|
||||||
rej(err);
|
res();
|
||||||
|
} else {
|
||||||
|
rej('Unable to kill process');
|
||||||
}
|
}
|
||||||
res();
|
} else {
|
||||||
});
|
treeKill(serverProcess.pid, (err) => {
|
||||||
|
if (err) {
|
||||||
|
rej(err);
|
||||||
|
}
|
||||||
|
res();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -359,13 +359,21 @@ class RunningNodeProcess implements RunningTask {
|
|||||||
|
|
||||||
kill(signal?: NodeJS.Signals | number): Promise<void> {
|
kill(signal?: NodeJS.Signals | number): Promise<void> {
|
||||||
return new Promise<void>((res, rej) => {
|
return new Promise<void>((res, rej) => {
|
||||||
treeKill(this.childProcess.pid, signal, (err) => {
|
if (process.platform === 'win32' || process.platform === 'darwin') {
|
||||||
if (err) {
|
if (this.childProcess.kill(signal)) {
|
||||||
rej(err);
|
|
||||||
} else {
|
|
||||||
res();
|
res();
|
||||||
|
} else {
|
||||||
|
rej('Unable to kill process');
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
treeKill(this.childProcess.pid, signal, (err) => {
|
||||||
|
if (err) {
|
||||||
|
rej(err);
|
||||||
|
} else {
|
||||||
|
res();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user