From: Omar Sandoval Date: Fri, 5 May 2017 18:40:54 +0000 (-0700) Subject: check: check if stdout is a tty before using terminal commands X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c0c2c0fde9f4dff47bc052fefe7fa2962fccf62d;p=users%2Fsagi%2Fblktests.git check: check if stdout is a tty before using terminal commands Signed-off-by: Omar Sandoval --- diff --git a/check b/check index 902b208..b995e6a 100755 --- a/check +++ b/check @@ -94,9 +94,11 @@ _output_last_test_run() { } _output_test_run() { - # -4 for date, status, reason, and exit_status, which we don't output, - # +1 for the test name. - tput cuu $((${#LAST_TEST_RUN[@]} - 3)) + if [[ -t 1 ]]; then + # -4 for date, status, reason, and exit_status, which we don't + # output, +1 for the test name. + tput cuu $((${#LAST_TEST_RUN[@]} - 3)) + fi if [[ -v TEST_DEV ]]; then echo "$TEST_NAME => $(basename "$TEST_DEV") ... [${TEST_RUN[status]}ed]"