properly cleanup exit process listener as browser closes
This commit is contained in:
parent
b6d0ebfbf2
commit
d120e7e426
@ -112,9 +112,11 @@ class Browser {
|
|||||||
let stderr = '';
|
let stderr = '';
|
||||||
this._chromeProcess.stderr.on('data', data => stderr += data.toString('utf8'));
|
this._chromeProcess.stderr.on('data', data => stderr += data.toString('utf8'));
|
||||||
// Cleanup as processes exit.
|
// Cleanup as processes exit.
|
||||||
process.on('exit', () => this._chromeProcess.kill());
|
const onProcessExit = () => this._chromeProcess.kill();
|
||||||
|
process.on('exit', onProcessExit);
|
||||||
this._chromeProcess.on('exit', () => {
|
this._chromeProcess.on('exit', () => {
|
||||||
this._terminated = true;
|
this._terminated = true;
|
||||||
|
process.removeListener('exit', onProcessExit);
|
||||||
removeRecursive(this._userDataDir);
|
removeRecursive(this._userDataDir);
|
||||||
});
|
});
|
||||||
this._chromeProcess.stderr.pipe(this.stderr);
|
this._chromeProcess.stderr.pipe(this.stderr);
|
||||||
|
Loading…
Reference in New Issue
Block a user