Commit 4db28b72 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Kill gulp-karma process on Ctrl-C

The only way to kill `yarn test --watch` is sending a SIGINT via a
<kbd>Ctrl</kbd>+<kbd>C</kbd> keyboard shorcut. Killing karma process in
this way sometimes leaves the parent gulp process orphan. That's because
when karma is killed by SIGINT sometimes doesn't run the `done` in the
callback, hence leaving the gulp process waiting for the `done` signal.

On more rare occasions, I have seen orphan karma process too.

The solution presented here registers a listener for SIGINT and call the
`done` function. It doesn't unregister the event.
parent f49246b8
......@@ -352,6 +352,15 @@ function runKarma(done) {
),
done
).start();
process.on('SIGINT', () => {
// Give Karma a chance to handle SIGINT and cleanup, but forcibly
// exit if it takes too long.
setTimeout(() => {
done();
process.exit(1);
}, 5000);
});
}
// Unit and integration testing tasks.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment