pipefail doesn't work on NetBSD or FreeBSD
Hal Murray
hmurray at megapathdsl.net
Sat Oct 13 19:47:47 UTC 2018
> ./waf configure --out=$DIR $2 2>&1 | tee $DIR/test.log
> The scripts run something (./waf configure in this case), and put the output
> into a pipe to log it.
> Then next, there is a need to see if any part of the pipeling failed. But /
> bin/sh on *BSD only reports if the last part of the pipeline failed. tee
> rarely fails.
> "set -o pipefail" is supposed to return fail to $? if any part of the
> pipeline failed.
> Any ideas how to do that?
Can we do what we need with ()s?
For example:
(
./waf configure --out=$DIR $2 2>&1
FOO=$?
) | tee $DIR/test.log
That doesn't test the tee step, but the old bash code didn't do that either.
------
PS: The bash version didn't work on NetBSD or FreeBSD either.
-#!/usr/bin/env bash
-# sh on NetBSD and FreeBSD says:
-# sh: ${PIPESTATUS[...}: Bad substitution
--
These are my opinions. I hate spam.
More information about the devel
mailing list