fix: Browser not getting closed on manual exit

This commit is contained in:
Simeon Radivoev 2026-03-15 16:38:01 +02:00
parent 90f9221a80
commit 489124a4a3
Signed by: simeonradivoev
GPG key ID: C16C2132A7660C8E
2 changed files with 17 additions and 17 deletions

View file

@ -172,17 +172,10 @@ export async function killBrowser (browser: Subprocess)
{
if (os.platform() === 'linux')
{
// kill chrome by your unique identifier
await $`pkill -KILL -P ${browser.pid}`.quiet().nothrow();
// we have to force kill the demon spawn for some reason, doesn't respond to SIGTERM
await $`pkill -SIGKILL -P ${browser.pid}`.nothrow();
} else
{
browser?.kill(15);
browser?.kill('SIGTERM');
}
}
// --- Test Run ---
// spawnBrowser({
// browser: "chrome",
// args: ["--window-size=1024,640", "--force-device-scale-factor=1.25"],
// detached: true
// });
}