]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
check: check if stdout is a tty before using terminal commands
authorOmar Sandoval <osandov@fb.com>
Fri, 5 May 2017 18:40:54 +0000 (11:40 -0700)
committerOmar Sandoval <osandov@fb.com>
Fri, 5 May 2017 18:40:54 +0000 (11:40 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
check

diff --git a/check b/check
index 902b20812105c8a5ea7278fdcad273d567849419..b995e6a0e9b19c779a8e334cac5a6447c60f19a7 100755 (executable)
--- 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]"