bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exit trap defined in function body isn't triggered


From: Oğuz
Subject: exit trap defined in function body isn't triggered
Date: Mon, 30 Mar 2020 21:45:48 +0300

Consider this:

bash <<EOF
foo() {
  trap 'echo exit' EXIT
}
foo &
EOF

After trap is set, the subshell exits and `echo exit` should be run,
but it won't. If you set a RETURN trap instead it works though. This
is reproducible on bash4 and bash5

-- 
Oğuz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]