summaryrefslogtreecommitdiff
path: root/tests/trap4.sub
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2013-08-12 19:18:42 -0400
committerChet Ramey <chet.ramey@case.edu>2013-08-12 19:18:42 -0400
commit1442f67c408e60769ff344f9e4c05104e2cef7d0 (patch)
tree6c093574f9b9342f172a8d8367aa9a5849cd4d85 /tests/trap4.sub
parent25eee30b53c60c43b155880820d29c84928847ca (diff)
downloadbash-4.3-beta.tar.gz
bash-4.3-beta overlaybash-4.3-beta
Diffstat (limited to 'tests/trap4.sub')
-rw-r--r--tests/trap4.sub25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/trap4.sub b/tests/trap4.sub
index 6a8abdac..ab5ca3e3 100644
--- a/tests/trap4.sub
+++ b/tests/trap4.sub
@@ -15,3 +15,28 @@ trap 'echo inherited exit trap' EXIT
: | ( exit; ) | : ; echo outside 4
trap - EXIT
+
+# make sure group commands that are not at the beginning or end of pipelines
+# run an EXIT trap, with and without the exit builtin
+echo ignored |
+{
+ trap 'echo "in trap EXIT">&2' EXIT
+ sleep 4 &
+ echo 'sleep 2'>&2
+ sleep 2
+ echo 'wait $!'>&2
+ wait $!
+ echo 'exit'>&2
+ exit
+} | cat
+
+echo ignored |
+{
+ trap 'echo "in trap EXIT">&2' EXIT
+ sleep 4 &
+ echo 'sleep 2'>&2
+ sleep 2
+ echo 'wait $!'>&2
+ wait $!
+ echo 'exit'>&2
+} | cat