mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
tests/signal.sh: fix AT&T's err_exit bogosity (re: 712261c8
)
This commit is contained in:
parent
6829fc9a29
commit
98ea0c2dbb
1 changed files with 7 additions and 4 deletions
|
@ -49,18 +49,21 @@ done
|
||||||
done
|
done
|
||||||
EOF
|
EOF
|
||||||
} | head > /dev/null
|
} | 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.
|
|
||||||
[[ $(<out2) == $'PIPED\nPIPED' ]] || err_exit 'SIGPIPE output on standard error is not correct'
|
|
||||||
) &
|
) &
|
||||||
cop=$!
|
cop=$!
|
||||||
{ sleep .4; kill $cop; } 2>/dev/null &
|
{ sleep .4; kill $cop; } 2>/dev/null &
|
||||||
spy=$!
|
spy=$!
|
||||||
if wait $cop 2>/dev/null
|
if wait $cop 2>/dev/null
|
||||||
then kill $spy 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
|
fi
|
||||||
wait
|
wait
|
||||||
|
exp=$'PIPED\nPIPED'
|
||||||
|
[[ $(<out2) == "$exp" ]] || err_exit 'SIGPIPE output on standard error is not correct' \
|
||||||
|
"(expected $(printf %q "$exp"), got $(printf %q "$(<out2)"))"
|
||||||
rm -f out2
|
rm -f out2
|
||||||
|
|
||||||
actual=$( trap 'print -n got_child' SIGCHLD
|
actual=$( trap 'print -n got_child' SIGCHLD
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue