gulp-webdriver
gulp-webdriver copied to clipboard
SIGINT handler is not killing process
From @artur-michalak on January 4, 2017 12:5
The problem
When i setup webdriver.io with gulp watch and interrupt process with ctrl+c it's not closing.
Environment
-
WebdriverIO version: v4.5.2
-
Node.js version: v4.4.5 (v6 too)
-
Standalone mode or wdio testrunner: jasmine testrunner
-
if wdio testrunner, running synchronous or asynchronous tests: asynchronous
-
Additional wdio packages used (if applicable):
"wdio-dot-reporter": "0.0.6", "wdio-jasmine-framework": "^0.2.19", "wdio-selenium-standalone-service": "0.0.7", "gulp-webdriver": "^2.0.3",
Link to Selenium/WebdriverIO logs
[12:56:45] Finished 'e2e:run' after 16 s [12:56:45] Finished 'e2e:dev' after 17 s then on cmd + c click:
End selenium sessions properly ... (press crtl+c again to hard kill the runner)
Killing process, bye! (on cmd + c click) Killing process, bye! (on cmd + c click) Killing process, bye! (on cmd + c click) Killing process, bye! (on cmd + c click)
Code To Reproduce Issue [ Good To Have ]
- Setup gulp gulp.task('e2e:run', function () { return gulp.src(config.e2e.config).pipe(webdriver({ baseUrl: 'http://localhost:' + config.e2e.port, specs: config.e2e.specs })).on('error', handleErrors); });
// production release of player gulp.task('e2e:dev', function() { gulp.watch(config.e2e.specs, ['e2e:run']); });
- Run e2e:run task. Everything works like a charm
- Run e2e:dev which is watching files
- Interrupt (ctrl + c/cmd+c) twice
- Gulp process is not killed
Details
I would guess something is wrong with logic here https://github.com/webdriverio/webdriverio/blob/68974ac33aa13fa099b1870d5a81ce5c6d8341db/lib/launcher.js#L418 Perhaps process.exit is not being called.
Copied from original issue: webdriverio/webdriverio#1798
i have the exact same issue. i have a feeling this is because of gulp which is not passing on signals correctly.
What is the status of this issue?
Not sure why this got moved from webdriverio as grunt-webdriver exhibits it as well. Any news?
I am not using gulp-webdriver so if anyone has a solution to this any PRs would be appreciated
There is one solution that I found to be working - its not ideal but it is something. Returned through2
stream has an event finish
which you could use to exit the process.
Ex.
webdriver({
baseUrl: 'http://localhost:' + config.e2e.port,
specs: config.e2e.specs
}).on(`finish`, () => process.exit(0));
@stsvilik effectively closing the process, the only bad thing is that it eliminates all the underlying sub-processes. I have built a nodeJS server and when applying this solution it stops the service.
There should be some way to get PID and stop just that process. Maybe you can use process.kill (pid [, signal])
@jasp402 If only we had reference to the right process which spawns webdriver
, we could kill just that.