question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple processes exiting with code 0 or SIGTERM produce a non-zero exit code

See original GitHub issue

4.1.0

This is my output. All the processes are exiting with 0 or SIGTERM. But the final exit code is non-zero.

[test  ] npm run test:docker:sleep exited with code 0
--> Sending SIGTERM to other processes..
[server] [mock   ] npm run start:mockserver:nobunyan exited with code SIGTERM
[server] [nes    ] DOCKER=1 nessie start exited with code 0
[server] [webpack] npm run webpack:server exited with code 0
[server] npm ERR! code ELIFECYCLE

Here are my npm scripts:

  "start:docker": "concurrently --n  'nes    ,mock   ,webpack' -s 'first' 'DOCKER=1 nessie start' 'npm run start:mockserver:nobunyan' 'npm run webpack:server'",

  "test:docker:sleep":  "sleep 10 && npm run --prefix functional-tests test:docker",
  "test:functional:docker:ra": "npm-run-all --parallel -lr 'test:docker:sleep' 'start:docker'",
  "test:functional:docker": "concurrently -n 'test  ,server' -s 'first' --kill-others 'npm run test:docker:sleep' 'npm run start:docker' ",

test:functional:docker:ra runs the same commands but exits with 0 (the desired output).

I need this exit code for my build pipeline.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
taxiliancommented, May 18, 2021

This is very frustrating as it means I can’t use --kill-others in any reasonable way without making it erroneously think there is an error.

2reactions
Th3S4mur41commented, Oct 11, 2022

Although this would be a breaking change. I would definitely expect the exit code to be the one from the first process with --kill-others In that case I most likely don’t care about the other processes’ exit code since I decide to kill them before they are done.

The most prominent use case is killing a (web) server when the tests you wanted to run on it are done. The exit code of the tests is definitely relevant, but the one from the server is not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exits with code 1 on SIGTERM without waiting for child #4667
The issue that this stemmed from was about handling SIGTERM events (#3424) and was introduced in pull request #3789.
Read more >
A brand new website interface for an even better experience!
Multiple processes exiting with code 0 or SIGTERM produce a non-zero exit code.
Read more >
Set exit code when receiving SIGTERM in Quarkus
I'd like to know how I can tell Quarkus to gracefully exit with code 0 upon receiving SIGTERM. I'd still like to react...
Read more >
process termination - Make Linux Software
An exit code of zero indicates correct execution, while a nonzero exit code indicates that an error occurred. In the latter case, the...
Read more >
Keep exit codes when trapping SIGINT and similar?
I solved it now by simply exiting with some error codes hardcoded and trapping EXIT. This might be problematic on certain systems because...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found