public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] test: term: When checking if status line is a number, hide errors
@ 2022-09-14  9:57 Stefano Brivio
  2022-09-14 11:56 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2022-09-14  9:57 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

We use the [ "$x" -eq "$x" ] syntax to check if $x is a number. The
behaviour is clearly implied by POSIX, but some shells might actually
report the (intended) error, and dash floods script.log with
"Illegal number" error messages. Hide them.

Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 test/lib/term | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lib/term b/test/lib/term
index b31deac..eade2cd 100755
--- a/test/lib/term
+++ b/test/lib/term
@@ -232,7 +232,7 @@ pane_status() {
 	[ ${DEMO} -eq 1 ] && return 0
 
 	__status="$(pane_parse "${1}")"
-	while ! [ "${__status}" -eq "${__status}" ]; do
+	while ! [ "${__status}" -eq "${__status}" ] 2>/dev/null; do
 		sleep 1
 		pane_run "${1}" 'echo $?'
 		pane_wait "${1}"
-- 
@@ -232,7 +232,7 @@ pane_status() {
 	[ ${DEMO} -eq 1 ] && return 0
 
 	__status="$(pane_parse "${1}")"
-	while ! [ "${__status}" -eq "${__status}" ]; do
+	while ! [ "${__status}" -eq "${__status}" ] 2>/dev/null; do
 		sleep 1
 		pane_run "${1}" 'echo $?'
 		pane_wait "${1}"
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-14 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  9:57 [PATCH] test: term: When checking if status line is a number, hide errors Stefano Brivio
2022-09-14 11:56 ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).