mmstick/parallel

Mimic GNU Parallel's behavior regarding failing jobs

justinas opened this issue · 3 comments

From my testing, parallel does not have the same behavior as GNU Parallel when some of the jobs fail:

justinas@js:~$ /usr/bin/parallel false ::: a b c; echo $?
3
justinas@js:~$ ~/bin/parallel false ::: a b c; echo $?
0

That is, GNU Parallel will return a non-zero status code indicating how many jobs have failed, while mmstick/parallel will return 0 even if some jobs fail. Returning a proper status code on failure would be a useful addition for scripting scenarios.

This behavior is documented in GNU Parallel's man page:

EXIT STATUS
       If --halt-on-error 0 or not specified:

       0     All jobs ran without error.

       1-253 Some of the jobs failed. The exit status gives the number of failed jobs

       254   More than 253 jobs failed.

       255   Other error.

       If --halt-on-error 1 or 2: Exit status of the failing job.

This will be done eventually. I'm working on the Ion shell at the moment though, and at some point I will attempt to merge the Ion shell as a library into this project to eliminate the need for an external shell, improve performance drastically, and for handling things like this better.

I've implemented this with commit cc2fc35

Amazing, thanks for doing this. 🙌