From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Thomas Haller <thaller@redhat.com>
Subject: [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals
Date: Sat, 23 Mar 2024 03:37:33 +0100 [thread overview]
Message-ID: <20240323023733.20253-1-phil@nwl.cc> (raw)
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>
---
tests/shell/run-tests.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 86c8312683ccb..6a9b518c3aed5 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
--
2.43.0
next reply other threads:[~2024-03-23 2:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-23 2:37 Phil Sutter [this message]
2024-04-12 12:42 ` [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240323023733.20253-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=thaller@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).