fix: Kill browser process when killing process group fails (#8477)
Fixes #8476. Similar fix to #8352 which only covered Windows.
This commit is contained in:
parent
b54dc55f76
commit
7dc8e37a23
@ -195,7 +195,7 @@ export class BrowserRunner {
|
|||||||
if (error) {
|
if (error) {
|
||||||
// taskkill can fail to kill the process e.g. due to missing permissions.
|
// taskkill can fail to kill the process e.g. due to missing permissions.
|
||||||
// Let's kill the process via Node API. This delays killing of all child
|
// Let's kill the process via Node API. This delays killing of all child
|
||||||
// proccesses of `this.proc` until the main Node.js process dies.
|
// processes of `this.proc` until the main Node.js process dies.
|
||||||
proc.kill();
|
proc.kill();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -203,7 +203,15 @@ export class BrowserRunner {
|
|||||||
// on linux the process group can be killed with the group id prefixed with
|
// on linux the process group can be killed with the group id prefixed with
|
||||||
// a minus sign. The process group id is the group leader's pid.
|
// a minus sign. The process group id is the group leader's pid.
|
||||||
const processGroupId = -this.proc.pid;
|
const processGroupId = -this.proc.pid;
|
||||||
|
|
||||||
|
try {
|
||||||
process.kill(processGroupId, 'SIGKILL');
|
process.kill(processGroupId, 'SIGKILL');
|
||||||
|
} catch (error) {
|
||||||
|
// Killing the process group can fail due e.g. to missing permissions.
|
||||||
|
// Let's kill the process via Node API. This delays killing of all child
|
||||||
|
// processes of `this.proc` until the main Node.js process dies.
|
||||||
|
proc.kill('SIGKILL');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
Loading…
Reference in New Issue
Block a user