* [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals
@ 2024-03-23 2:37 Phil Sutter
2024-04-12 12:42 ` Phil Sutter
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2024-03-23 2:37 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel, Thomas Haller
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals
2024-03-23 2:37 [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals Phil Sutter
@ 2024-04-12 12:42 ` Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2024-04-12 12:42 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel, Thomas Haller
On Sat, Mar 23, 2024 at 03:37:33AM +0100, Phil Sutter wrote:
> 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>
Patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-12 12:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23 2:37 [nft PATCH] tests: shell: Avoid escape chars when printing to non-terminals Phil Sutter
2024-04-12 12:42 ` Phil Sutter
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 NNTP newsgroup(s).