Open myitcv opened 5 years ago
To ensure any failures bubble up to the top-level script.
Also, for process substitutions:
cat <(echo "hello"; false; echo "nothing") <(echo "goodbye"; false; echo "really")
will need to be rewritten to something like:
pushd $(mktemp -d) > /dev/null mkfifo f1 (set -eu; set -o pipefail; echo "hello"; $comm; echo "nothing") > f1 2>&1 & echo $! >> pids mkfifo f2 (set -eu; set -o pipefail; echo "goodbye"; $comm; echo "really") > f2 2>&1 & echo $! >> pids cat f1 f2 for pid in $(<pids) do wait $pid || echo $pid >> failed done if [ -e failed ] then echo "command failed" rm -rf $PWD popd > /dev/null false else rm -rf $PWD popd > /dev/null fi
which gives:
$ pushd $(mktemp -d) >/dev/null $ mkfifo f1 $ ( set -eu set -o pipefail echo "hello" false echo "nothing" ) >f1 2>&1 & $ echo $! >>pids $ mkfifo f2 $ ( set -eu set -o pipefail echo "goodbye" false echo "really" ) >f2 2>&1 & $ echo $! >>pids $ cat f1 f2 hello goodbye $ for pid in $(<pids); do wait $pid || echo $pid >>failed done $ if [ -e failed ]; then echo "command failed" rm -rf $PWD popd >/dev/null false else rm -rf $PWD popd >/dev/null fi command failed
To ensure any failures bubble up to the top-level script.
Also, for process substitutions:
will need to be rewritten to something like:
which gives: