parallelshell icon indicating copy to clipboard operation
parallelshell copied to clipboard

Exit code is 0 when first command succeeds and second fails

Open nene opened this issue 8 years ago • 4 comments

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.

nene avatar Nov 24 '16 09:11 nene

Same issue here

AndyOGo avatar Jun 18 '18 14:06 AndyOGo

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

AndyOGo avatar Jun 18 '18 14:06 AndyOGo

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

andrestaht avatar Jun 18 '18 14:06 andrestaht

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

AndyOGo avatar Jun 18 '18 14:06 AndyOGo