darkguy2008 / parallelshell

Run multiple shell commands in parallel
501 stars 44 forks source link

Exit code is 0 when first command succeeds and second fails #55

Open nene opened 7 years ago

nene commented 7 years ago

With single command the exit code is as expected:

$ parallelshell "ls asdf"
ls: asdf: No such file or directory
$ echo $?
1

With multiple commands it exits with 1 when the first command exits with 1:

$ parallelshell "ls asdf" "ls ."
asdf: No such file or directory
$ echo $?
1

But when the first command succeeds and second fails, it exits with 0:

$ parallelshell "ls ." "ls asdf"
asdf: No such file or directory
$ echo $?
0

I tried using --wait but then it always exits with 0.

But the documentation says:

If command1 or command2 exit with non-zero exit code, then this will not effect the outcome of your shell (i.e. they can fail and npm/bash/whatever will ignore it). parallelshell will not ignore it, and will exit with the first non-zero exit code.

AndyOGo commented 6 years ago

Same issue here

AndyOGo commented 6 years ago

BTW. the documentation is also misleading, as it claims that exit codes are properly handled.

andrestaht commented 6 years ago

@AndyOGo we switched to https://github.com/kimmobrunfeldt/concurrently

AndyOGo commented 6 years ago

@andrestaht Thanks. I just created a PR for switching to concurrently :)