Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGINT handler is not killing process #56

Open
christian-bromann opened this issue Jan 4, 2017 · 7 comments
Open

SIGINT handler is not killing process #56

christian-bromann opened this issue Jan 4, 2017 · 7 comments

Comments

@christian-bromann
Copy link
Contributor

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 ]

  1. 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']);
});

  1. Run e2e:run task. Everything works like a charm
  2. Run e2e:dev which is watching files
  3. Interrupt (ctrl + c/cmd+c) twice
  4. 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

@sandys
Copy link

sandys commented Feb 18, 2017

i have the exact same issue. i have a feeling this is because of gulp which is not passing on signals correctly.

@gpolyn
Copy link

gpolyn commented Apr 4, 2017

What is the status of this issue?

@jsdtaylor
Copy link

Not sure why this got moved from webdriverio as grunt-webdriver exhibits it as well. Any news?

@christian-bromann
Copy link
Contributor Author

I am not using gulp-webdriver so if anyone has a solution to this any PRs would be appreciated

@stsvilik
Copy link

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));

@jasp402
Copy link

jasp402 commented May 9, 2018

@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])

@stsvilik
Copy link

@jasp402 If only we had reference to the right process which spawns webdriver, we could kill just that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants