diff options
author | jilles <jilles@FreeBSD.org> | 2011-04-23 22:28:56 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-04-23 22:28:56 +0000 |
commit | f250dc2f449b2e81b05be3a09647011b8a783e81 (patch) | |
tree | 1769bded7ead74e70ac17d9570ffab4c573e0ade /sys/conf | |
parent | d98bdded177a447c277598fa1add5fef3738ed9f (diff) | |
download | FreeBSD-src-f250dc2f449b2e81b05be3a09647011b8a783e81.zip FreeBSD-src-f250dc2f449b2e81b05be3a09647011b8a783e81.tar.gz |
sh: Allow EV_EXIT through function calls, make {...} <redir more consistent.
If EV_EXIT causes an exit, use the exception mechanism to unwind
redirections and local variables. This way, if the final command is a
redirected command, an EXIT trap now executes without the redirections.
Because of these changes, EV_EXIT can now be inherited by the body of a
function, so do so. This means that a function no longer prevents a fork
before an exec being skipped, such as in
f() { head -1 /etc/passwd; }; echo $(f)
Wrapping a single builtin in a function may still cause an otherwise
unnecessary fork with command substitution, however.
An exit command or -e failure still invokes the EXIT trap with the
original redirections and local variables in place.
Note: this depends on SHELLPROC being gone. A SHELLPROC depended on
keeping the redirections and local variables and only cleaning up the
state to restore them.
Diffstat (limited to 'sys/conf')
0 files changed, 0 insertions, 0 deletions