From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: [BUG] exec + builtin and traps
Date: Tue, 12 Sep 2017 11:19:06 +0100 [thread overview]
Message-ID: <20170912111906.397cffec@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20170912100257.GA32535@zira.vinc17.org>
On Tue, 12 Sep 2017 12:02:57 +0200
Vincent Lefevre <vincent@vinc17.net> wrote:
> 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.
It means immediately after the command has finished executing, not while
it's executing.
> #!/usr/bin/env zsh
>
> trap 'echo foo' USR1
>
> echo $$
> ( sleep 1; kill -USR1 $$ ) &
> exec eval sleep 2
So in your case it's still exectuing the eval sleep 2.
I don't actually understand your interpretation --- given eval is a
builtin and the eval is going to take 2 seconds because it dispatches to
a sleep, how could the shell exit before that?
pws
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 3afe990..d6aa078 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -669,7 +669,7 @@ an empty string or whitespace) the return status is zero.
item(tt(exec) [ tt(-cl) ] [ tt(-a) var(argv0) ] [ var(command) [ var(arg) ... ] ])(
Replace the current shell with var(command) rather than forking.
If var(command) is a shell builtin command or a shell function,
-the shell executes it, then immediately exits.
+the shell executes it, and exits when the command is complete.
With tt(-c) clear the environment; with tt(-l) prepend tt(-) to the
tt(argv[0]) string of the command executed (to simulate a login shell);
next prev parent reply other threads:[~2017-09-12 10:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170912101045epcas2p4cae7e7df78ef035900f9c6099dc054fb@epcas2p4.samsung.com>
2017-09-12 10:02 ` Vincent Lefevre
2017-09-12 10:19 ` Peter Stephenson [this message]
2017-09-12 10:39 ` Vincent Lefevre
2017-09-12 10:50 ` Peter Stephenson
2017-09-12 11:42 ` Vincent Lefevre
2017-09-12 11:51 ` Peter Stephenson
2017-09-12 12:02 ` Vincent Lefevre
2017-09-12 12:10 ` Peter Stephenson
2017-09-12 14:21 ` trap, eval and wait (was: [BUG] exec + builtin and traps) Vincent Lefevre
2017-09-12 15:04 ` Peter Stephenson
2017-09-13 9:55 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170912111906.397cffec@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).