fix: improve Ctrl + C support (#6011)

Fix child process killing when the parent process SIGINTs.

If you `ctrl + c` the Puppeteer parent process, we would sometimes not properly handle killing of the child processes. This would then leave child processes behind, with running Chromium instances. This in turn could block Puppeteer from launching again and results in
cryptic errors.

Instead of using the generic `process.kill` with the process id (which for some reason is negative the pid, which I don't get), we can kill the child process directly by calling `proc.kill`.

Fixes #5729.
Fixes #4796.
Fixes #4963.
Fixes #4333.
Fixes #1825.
This commit is contained in:
Tim van der Lippe
2020-06-15 14:02:00 +01:00
committed by GitHub
parent b659969a38
commit 03ab1c1b9c
3 changed files with 27 additions and 13 deletions

View File

@@ -71,7 +71,7 @@ try {
const defaultBrowserOptions = Object.assign(
{
handleSIGINT: false,
handleSIGINT: true,
executablePath: process.env.BINARY,
slowMo: false,
headless: isHeadless,