launcher: close browser on node exit
This commit is contained in:
parent
2d1c049a6d
commit
fba2dbeaa4
@ -181,8 +181,24 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
|
|||||||
versions
|
versions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Close window fully internally if browser process closes
|
||||||
proc.on('close', Window.close);
|
proc.on('close', Window.close);
|
||||||
|
|
||||||
|
|
||||||
|
// Close browser fully if Node exits
|
||||||
|
process.on('exit', Window.close);
|
||||||
|
|
||||||
|
const interruptHandler = () => {
|
||||||
|
Window.close();
|
||||||
|
process.exit();
|
||||||
|
};
|
||||||
|
|
||||||
|
process.on('SIGINT', interruptHandler);
|
||||||
|
process.on('SIGUSR1', interruptHandler);
|
||||||
|
process.on('SIGUSR2', interruptHandler);
|
||||||
|
process.on('SIGTERM', interruptHandler);
|
||||||
|
|
||||||
|
|
||||||
Window.idle = await IdleApi(Window.cdp, { browserType, closeHandlers });
|
Window.idle = await IdleApi(Window.cdp, { browserType, closeHandlers });
|
||||||
Window.controls = await ControlsApi(Window.cdp);
|
Window.controls = await ControlsApi(Window.cdp);
|
||||||
Window.v8Cache = await V8CacheApi(Window.cdp, evalInWindow, { browserType, dataPath });
|
Window.v8Cache = await V8CacheApi(Window.cdp, evalInWindow, { browserType, dataPath });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user