run_check_stdout() uses "... | tee ... || _fail". However, since tee
won't fail, _fail() is not called even if first command fails.
Fix this by checking PIPESTATUS in the end.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
echo "############### $@" >> "$RESULTS" 2>&1
if [[ $TEST_LOG =~ tty ]]; then echo "CMD(stdout): $@" > /dev/tty; fi
if [ "$1" = 'root_helper' ]; then
- "$@" 2>&1 | tee -a "$RESULTS" || _fail "failed: $@"
+ "$@" 2>&1 | tee -a "$RESULTS"
else
- $INSTRUMENT "$@" 2>&1 | tee -a "$RESULTS" || _fail "failed: $@"
+ $INSTRUMENT "$@" 2>&1 | tee -a "$RESULTS"
+ fi
+ if [ ${PIPESTATUS[0]} -ne 0 ]; then
+ _fail "failed: $@"
fi
}