Handling process exit#1249
Conversation
| eventsUtils.passthroughEvent(this.runner, this, _.values(MasterSyncEvents)); | ||
| eventsUtils.passthroughEventAsync(this.runner, this, _.values(MasterAsyncEvents)); | ||
| eventsUtils.passthroughEventAsync(signalHandler, this, MasterEvents.EXIT); | ||
| eventsUtils.passthroughEventAsync(signalHandler, this.runner, MasterEvents.EXIT); |
There was a problem hiding this comment.
pass exit event to runner
There was a problem hiding this comment.
Refactoring this to typescript
|
|
||
| let lastCallTime = 0; | ||
|
|
||
| const throttleTime = 10; |
There was a problem hiding this comment.
Throttle for SIGINT, by some reason if kill using Control + C event fired twice with delay 7-8ms, probably it is duplicates from webdriver.io
| logger.error(`testplane:worker:${child.pid} terminated unexpectedly with ${errMsg}`); | ||
| }); | ||
|
|
||
| this.once(MasterEvents.EXIT, () => child.kill()); |
There was a problem hiding this comment.
Kill child process if get EXIT event from master (through runner)
| this.workers = this.registerWorkers(require.resolve("../worker"), ["runTest", "cancel"] as const) as Workers; | ||
| this.browserPool = pool.create(this.config, this); | ||
|
|
||
| eventsUtils.passthroughEvent(this, this.workersRegistry, MasterEvents.EXIT); |
There was a problem hiding this comment.
Pass event to childs
| this._emit(MasterEvents.TEST_PASS); | ||
| } catch (error) { | ||
| this._test.err = error; | ||
| this._test.err = this._browser.exitError || error; |
There was a problem hiding this comment.
Use exit error if exist
| super(config, opts); | ||
|
|
||
| signalHandler.on("exit", () => this.quit()); | ||
| signalHandler.on("exit", (err?: Error) => this.quit(err)); |
There was a problem hiding this comment.
pass error from exit event
|
|
||
| async quit(): Promise<void> { | ||
| async quit(err?: Error): Promise<void> { | ||
| this._exitError = err; |
There was a problem hiding this comment.
save in browser for using in test fail
e05cedc to
395f2fa
Compare
395f2fa to
8a45901
Compare
There was a problem hiding this comment.
Refactor to typescript
There was a problem hiding this comment.
Refactor to typescript
commit: |
fail current running test with specific error before process exit
