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 <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-12-06 16:36:50 -05:00
parent 9f76d4c7a5
commit 1f1b9faacb
1 changed files with 4 additions and 2 deletions

View File

@ -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"