Using a more elegant way to obtain pipe component exit value
This commit is contained in:
parent
978e94bb3d
commit
2a74987925
@ -129,9 +129,17 @@ fi
|
|||||||
T1=`date '+%s'`
|
T1=`date '+%s'`
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
return_wrapper ./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG}
|
if test -n "$PIPESTATUS"
|
||||||
RET=$(cat "$return_value_file")
|
then
|
||||||
rm "$return_value_file"
|
# PIPESTATUS[0] should be available in bash
|
||||||
|
./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG}
|
||||||
|
RET="${PIPESTATUS[0]}"
|
||||||
|
else
|
||||||
|
# a more portable method which uses a temporary file to record exit value
|
||||||
|
return_wrapper ./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG}
|
||||||
|
RET=$(cat "$return_value_file")
|
||||||
|
rm "$return_value_file"
|
||||||
|
fi
|
||||||
# echo "RET='$RET'" >/dev/tty
|
# echo "RET='$RET'" >/dev/tty
|
||||||
|
|
||||||
T2=`date '+%s'`
|
T2=`date '+%s'`
|
||||||
|
Loading…
Reference in New Issue
Block a user