jobs: Implement pipefail option

With the pipefail option set, a pipeline's exit status is the exit
status of the rightmost command that failed, or zero if all commands
succeeded.

This is planned for inclusion in the next revision of POSIX [1],
although the details are yet to be finalised. The semantics of this
implementation are the same as those proposed in [2], which have also
been adopted by the BSD shells.

[1] https://www.austingroupbugs.net/view.php?id=789
[2] https://www.austingroupbugs.net/view.php?id=789#c4115

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 files changed