Permalink
Browse files

A couple more tests for errexit involving subprocesses.

Didn't find any divergence in shell behavior.
  • Loading branch information...
Andy Chu
Andy Chu committed Jan 11, 2018
1 parent 74e14e0 commit 4b0814647f53341029a1ee0c631cd97be9174cf8
Showing with 27 additions and 1 deletion.
  1. +27 −1 spec/errexit.test.sh
View
@@ -211,7 +211,7 @@ echo 7
6
## END
### errexit double quard
### errexit double guard
# OSH bug fix. ErrExit needs a counter, not a boolean.
set -o errexit
if { ! false; false; true; } then
@@ -223,3 +223,29 @@ echo done
## STDOUT:
true
## END
### background processes respect errexit
set -o errexit
{ echo one; false; echo two; exit 42; } &
wait $!
## status: 1
## STDOUT:
one
## END
### pipeline process respects errexit
set -o errexit
# It is respected here.
{ echo one; false; echo two; } | cat
# Also respected here.
{ echo three; echo four; } | while read line; do
echo "[$line]"
false
done
echo four
# status: 1
## STDOUT:
one
[three]
## END

0 comments on commit 4b08146

Please sign in to comment.