From 1f1b9faacbd9c2de3b9c896752280c08e9d86f74 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 6 Dec 2017 16:36:50 -0500 Subject: [PATCH] fix command handling in tox-log-command.sh Exit with an error if the pipeline produces an error and run the correct command rather than the part of the command name used for the output filename. Change-Id: I0754ab219983cad3eb8dae327a5435d094f8cf85 Signed-off-by: Doug Hellmann --- tools/tox-log-command.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tox-log-command.sh b/tools/tox-log-command.sh index 427b16fed4..1fef929443 100755 --- a/tools/tox-log-command.sh +++ b/tools/tox-log-command.sh @@ -18,7 +18,6 @@ # under the License. cmd=$(basename "$1" | cut -f1 -d.) -shift if [ -z "$LOGDIR" ]; then echo "LOGDIR variable not set." @@ -29,4 +28,7 @@ logfile="$LOGDIR/$cmd-results.log" echo "Logging $cmd output to $logfile" -$cmd "$@" 2>&1 | tee "$logfile" +# Fail if any part of the pipe fails. +set -o pipefail + +$@ 2>&1 | tee "$logfile"