Closed michaelsync closed 1 year ago
The exit code of concurrently
will be 1
so bash never runs the command after &&
.
If it is really such a simple use case, I'd probably go without concurrently
and instead use the command timeout
, for example.
If there are other reasons for you to stay with concurrently
, you could adjust the command to:
# to always run "npm run three"
npm run one && concurrently -k "node ./timeout.js" "npm run two"; npm run three
# or to run "npm run three" only if concurrently wasn't successful (timeout reached and therefore killed)
npm run one && concurrently -k "node ./timeout.js" "npm run two" || npm run three
See also https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Lists.
Let's say I have the following commands.
npm run one
npm run two
npm run three
I want to kill the command "two" after a specific time so I have a script file called timeout.js that includs this code
setTimeout(() => process.exit(1), 360000);
and then I run like that.
npm run one && concurrently -k "node ./timeout.js" "npm run two" && npm run three
It never reaches to "npm run three" because
concurrently
always kills the process. How do I tell to kill the processes in the scope which is "npm run two" and don't kill "npm run three" which comes after &&?