I am trying to run two scripts at once with concurrently
. The basic command looks something like this:
concurrently -k --success first "node ./tools/mock-webapi/mock-webapi.js" "npm run test-single-run"
Which in turn calls (local):
"test-single-run": "karma start --single-run --browsers ChromeHeadless"
Or on remote (teamcity host):
"test-teamcity": "karma start --reporters teamcity --single-run --browsers ChromeHeadless",
The tests run just fine (local & remote). However, I keep getting exit code 1. Even if I use concurrently -k --success first
I still get a code 1
even with --success first
.
[1] 09 05 2018 17:56:54.032:WARN [launcher]: ChromeHeadless was not killed in 2000 ms, sending SIGKILL.
[1] npm run test-single-run exited with code 0
--> Sending SIGTERM to other processes..
[0] node ./tools/mock-webapi/mock-webapi.js exited with code 1
I tried various ways for json-server
to gracefully receive this signal. Nothing seems to work.
mock-webapi.js
process.on('SIGTERM', function (code) {
console.log('Handle SIGTERM', process.pid, code);
exitCode = 0;
server.close(function () {
process.exit(0);
});
});
process.on('SIGKILL', function (code) {
console.log('SIGKILL received...', code);
exitCode = 0;
server.close(function () {
process.exit(0);
});
});
process.on('SIGINT', function (code) {
console.log('SIGINT received...', code);
exitCode = 0;
server.close(function () {
process.exit(0);
});
});