summaryrefslogtreecommitdiffstats
path: root/tests/shell
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-03-23 03:09:41 +0100
committerPhil Sutter <phil@nwl.cc>2024-04-12 14:41:34 +0200
commit83ed57d587afb248dc5dc72006b247319193008d (patch)
treea93b8327cd4bfd528620cbe4f3f8f01d8df903f3 /tests/shell
parent07c9733a4b4ab5b6f6fb94f305d323528a058823 (diff)
tests: shell: Avoid escape chars when printing to non-terminals
Print the 'EXECUTING' status line only if stdout is a terminal, the mandatory following escape sequence to delete it messes up log file contents. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/shell')
-rwxr-xr-xtests/shell/run-tests.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 86c83126..6a9b518c 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -860,7 +860,7 @@ job_start() {
local testfile="$1"
local testidx="$2"
- if [ "$NFT_TEST_JOBS" -le 1 ] ; then
+ if [ "$NFT_TEST_JOBS" -le 1 ] && [[ -t 1 ]]; then
print_test_header I "$testfile" "$testidx" "EXECUTING"
fi
@@ -873,7 +873,7 @@ job_start() {
$NFT_TEST_UNSHARE_CMD "$NFT_TEST_BASEDIR/helpers/test-wrapper.sh" "$testfile"
local rc_got=$?
- if [ "$NFT_TEST_JOBS" -le 1 ] ; then
+ if [ "$NFT_TEST_JOBS" -le 1 ] && [[ -t 1 ]]; then
echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line
fi