2023-02-12 17:20:28 +03:00
|
|
|
#!/bin/Shell
|
2020-08-10 22:41:49 +03:00
|
|
|
|
2021-01-25 07:42:30 +03:00
|
|
|
source $(dirname "$0")/test-commons.inc
|
2021-01-18 09:38:30 +03:00
|
|
|
|
2020-08-10 22:41:49 +03:00
|
|
|
# `head -n 1` should close stdout of the `Shell -c` command, which means the
|
|
|
|
# second echo should exit unsuccessfully and sigpipe.sh.out should not be
|
|
|
|
# created.
|
|
|
|
rm -f sigpipe.sh.out
|
|
|
|
|
2020-09-13 12:31:59 +03:00
|
|
|
{ echo foo && echo bar && echo baz > sigpipe.sh.out } | head -n 1 > /dev/null
|
2020-08-10 22:41:49 +03:00
|
|
|
|
|
|
|
# Failing commands don't make the test fail, just an explicit `exit 1` does.
|
|
|
|
# So the test only fails if sigpipe.sh.out exists (since then `exit 1` runs),
|
|
|
|
# not if the `test` statement returns false.
|
2021-01-18 09:38:30 +03:00
|
|
|
if test -e sigpipe.sh.out {
|
2021-12-03 13:53:42 +03:00
|
|
|
rm -f sigpipe.sh.out
|
2021-01-18 09:38:30 +03:00
|
|
|
fail sigpipe did not terminate further commands
|
|
|
|
} else {
|
|
|
|
echo PASS
|
|
|
|
}
|