Running the following results in extremely odd behavior from busybox (which should be relatively consistent unless your system is so slow that spawning 4 processes, printing a number and exiting takes more than an entire second to do): $ echo $(seq 1 100) | busybox xargs -n1 -P10 -- sh -c 'sleep "$0"; echo "$0"; [ "$0" = 2 ] && exit 0 || exit 255' 1 xargs: sh: exited with status 255; aborting 2 3 xargs: sh: exited with status 255; aborting $ 4 5 6 7 8 9 10 I would expect such a command line to result in one of the following: 1. xargs writes a diagnostic and waits for currently running invocations to exit before terminating, and prints more diagnostics if other invocations also exit with exit status 255 2. xargs writes a diagnostic and exits immediately, leaving the remaining currently running invocations orphaned 3. xargs writes a diagnostic and exits immediately after killing the remaining invocations still running Instead, xargs writes a diagnostic and waits for currently running invocations to exit, but if another invocation exits with exit status 255, it exits immediately, leaving the remaining currently running invocations orphaned, which seems like quite strange behavior, which I believe should be modified to be more sensible. PS: I have no particular preference for a specific option out of the three given above, especially given existing implementations are very divergent in this regard, although I would find 3. less attractive given it seems more likely to have unexpected results and no existing implementation behaves as such. PS 2: w.r.t. existing implementations: - GNU findutils does the same thing as busybox on my machine through pure happenstance, as in this situation it invokes undefined behavior by calling exit from an atexit handler and that happens to make it exit the second time it sees a process exiting with exit status 255 - FreeBSD does 1. - OpenBSD and illumos do 2. - Toybox is completely broken and doesn't end processing at all when it sees a process exiting with exit status 255, even though it prints a diagnostic
I'll add that toybox has now fixed their implementation and it now behaves like FreeBSD in this case.