Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] exec + builtin and traps
- X-seq: zsh-workers 41678
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] exec + builtin and traps
- Date: Tue, 12 Sep 2017 12:02:57 +0200
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
For zsh 5.4.1, the zshbuiltins(1) man page says:
exec [ -cl ] [ -a argv0 ] [ command [ arg ... ] ]
Replace the current shell with command rather than forking.
If command is a shell builtin command or a shell function,
the shell executes it, then immediately exits.
But consider the following script:
----------------------------------------
#!/usr/bin/env zsh
trap 'echo foo' USR1
echo $$
( sleep 1; kill -USR1 $$ ) &
exec eval sleep 2
----------------------------------------
"foo" is printed, meaning that the shell does not immediately exit
just after the command is executed, contrary to what the man page
says.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author