Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[BUG] exec + builtin and traps



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