mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(Launcher): killing a process can throw (#2102)
In case chrome process was terminated manually, killing the process might throw 'no process with such pid' exception.
This commit is contained in:
parent
ec3025fe84
commit
4e1f2e2eb2
@ -178,10 +178,14 @@ class Launcher {
|
|||||||
helper.removeEventListeners(listeners);
|
helper.removeEventListeners(listeners);
|
||||||
if (chromeProcess.pid && !chromeProcess.killed && !chromeClosed) {
|
if (chromeProcess.pid && !chromeProcess.killed && !chromeClosed) {
|
||||||
// Force kill chrome.
|
// Force kill chrome.
|
||||||
if (process.platform === 'win32')
|
try {
|
||||||
childProcess.execSync(`taskkill /pid ${chromeProcess.pid} /T /F`);
|
if (process.platform === 'win32')
|
||||||
else
|
childProcess.execSync(`taskkill /pid ${chromeProcess.pid} /T /F`);
|
||||||
process.kill(-chromeProcess.pid, 'SIGKILL');
|
else
|
||||||
|
process.kill(-chromeProcess.pid, 'SIGKILL');
|
||||||
|
} catch (e) {
|
||||||
|
// the process might have already stopped
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Attempt to remove temporary profile directory to avoid littering.
|
// Attempt to remove temporary profile directory to avoid littering.
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user