From 98ea0c2dbb0ade9fdf48582751a2cc38dba234eb Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 20 Nov 2021 03:03:00 +0100 Subject: [PATCH] tests/signal.sh: fix AT&T's err_exit bogosity (re: 712261c8) --- src/cmd/ksh93/tests/signal.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cmd/ksh93/tests/signal.sh b/src/cmd/ksh93/tests/signal.sh index b55ec56b6..ec95c10ae 100755 --- a/src/cmd/ksh93/tests/signal.sh +++ b/src/cmd/ksh93/tests/signal.sh @@ -49,18 +49,21 @@ done done EOF } | head > /dev/null - (( $? == 0)) || err_exit "SIGPIPE with wrong error code $?" - # The below is kind of bogus as the err_exit from a bg job is never counted. But see extra check below. - [[ $(/dev/null & spy=$! if wait $cop 2>/dev/null then kill $spy 2>/dev/null -else err_exit "pipe with --pipefail PIPE trap hangs or produced an error" +else # 'wait $cop' will have passed on the nonzero exit status from the background job into $? + e=$? + err_exit "pipe with --pipefail PIPE trap hangs or produced an error" \ + "(got status $e$( ((e>128)) && print -n /SIG && kill -l "$e"))" fi wait +exp=$'PIPED\nPIPED' +[[ $(