Open anselmdk opened 6 years ago
You may need to trap SIGTERM
in your script and gracefully kill the child processes you've started.
Wow. This was opened some good months ago... I'm sorry for such delay of mine 😞
I'm assuming that the code that listens for SIGINT
/SIGTERM
s is inherently broken on Windows, as signals don't exist there.
Some context: https://stackoverflow.com/a/14861513/2083599:
So, some further reading tells me that this may be an issue with old Node.js versions that didn't cope with this Windows limitation.
This reminded me that processes spawned by concurrently on Windows do run in non-detached mode though, so they should be killed when the parent process is terminated.
I will have to do some investigation on this.
@gustavohenke
Using GitHub Actions with ubuntu-latest
, macos-latest
, windows-latest
and it fails on windows-latest
with Node 12
and 14
, but it works with Node 16
:
npx concurrently --success=first "npx foo" "(sleep 5 || timeout 5 > NUL) && npx bar"
Notes:
foo
and bar
are hypothetical applications--success
does not matter - same problem occurs using it or notReal output:
👉 It appears that concurrently
is not parsing the arguments correctly for some reason.
This happens for me on Node18 on Windows 10.
Any child processes started by concurrently
are not killed when node exits, unless the parent node process was launched in cmd
or PowerShell and killed with ctrl+C.
I launch the parent node process from Java or another shell (e.g. Cygwin), and kill that process then all child processes are leaked.
I'm currently working around this by enumerating descendent processes and killing them directly.
Example:
We're having the following inside of our scripts in
package.json
(I've removed all unnecessary clutter):The
client.sh
file looks like this:Running
npm run test
works just fine, but stopping the script doesn't stop the triggered shell script nor the javascript script inside of it.