Comments (2)
Thanks for the comprehensive bug report!
We've had this behaviour for a long while (#150 + #164), which was probably pragmatic back then.
I think it's straightforward to fix this for unix-based systems; for Windows, it's more complicated due to it always using cmd.exe even on WSL.
from concurrently.
Here is a longread about best practices in shell-like programs (and programs launching other programs) on how to handle SIGINT: https://www.cons.org/cracauer/sigint.html
So if I understood you correctly, exiting cleanly with code 0 was intentionally implemented in #164, as a work-around, to not let npm print a nasty error message when ^C is pressed. If so, then I suspect that the implementation should've been different: instead of exiting with zero exitcode when a child process received a SIGINT (and thus making npm happy), concurrently
should've terminated itself with SIGINT in the end (instead of exiting with any exit code, 0 or not 0). In this case, I believe npm would behave nicely. This is all explained in details in the above article.
In short, there are 3 ways to terminate a process:
- Just finish running the code (in C, it's like exiting from main() function). Exit code will be 0 in this case (or N if returned N from main()). In Node, exit code is 0 when the script finishes normally.
- Calling process.exit(N). Exit code will be N. (Actually, (1) does exactly this internally.)
- Running
process.removeAllListeners("SIGINT"); process.kill(process.pid, "SIGINT")
(or any other signal, but SIGINT is the most interesting here). This is what a shell-like program (likeconcurrently
) should do when it detects that one of its children finished with SIGINT. Notice that this method has nothing to do with exit codes (although technically, the exit code is returned as 130, but the caller like npm or bash uses some special API to detect whether a child exited because of a signal or not).
from concurrently.
Related Issues (20)
- Build failed when using concurently HOT 17
- `--kill-others-on-fail` flag not working as expected with `--group --max-processes 1` HOT 5
- Filter for output of specific commands HOT 4
- Installing package from npm takes a long time HOT 4
- No colors for prefixes when using `prefixColors: "auto"` via concurrent API HOT 3
- How to combine with other node command HOT 1
- CLI options not clear in README HOT 1
- Installing package from npm cnpm yarn takes a long time HOT 2
- Logs of the commands running are not readable HOT 2
- Cancel a series of tasks with SIGINT HOT 5
- Feature Suggestion with wildcards HOT 1
- Error TS2349 using concurrently in full ESM module HOT 1
- Programmatically restarting Command using `kill/start` API produce wrong termination HOT 5
- Allow commands IPC HOT 4
- Feature request: Add or document API option to disable color output
- Prefix ([0] [1]) randomly missing HOT 1
- How to distinguish which process the output stream line comes from HOT 1
- No commands recognized when using via API HOT 1
- Please change the name of the project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concurrently.