zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: trap, eval and wait (was: [BUG] exec + builtin and traps)
Date: Tue, 12 Sep 2017 16:21:45 +0200	[thread overview]
Message-ID: <20170912142145.GA10597@cventin.lip.ens-lyon.fr> (raw)
In-Reply-To: <20170912131054.4f7c11a5@pwslap01u.europe.root.pri>

On 2017-09-12 13:10:54 +0100, Peter Stephenson wrote:
> On Tue, 12 Sep 2017 14:02:37 +0200
> Vincent Lefevre <vincent@vinc17.net> wrote:
> > Why is "foo" (from the trap) printed before "bar", then?
> 
> OK, so it's on the *sub* list after the command before the &&
> (wait) has executed successfully, but before the foo is executed.

I still don't understand. Actually, the real issue is that "wait"
should not have terminated successfully. Perhaps, this should be
clearer with:

------------------------------------------------------------
trap 'echo foo' USR1
( sleep 1; kill -USR1 $$; sleep 1; echo child ) &
eval "wait && echo bar"
echo OK
sleep 2
------------------------------------------------------------

After 1 second, the following is printed:

foo
bar
OK

And after another second:

child

So, this means that the "wait" has ended due to the USR1 signal, not
by a process termination. But then, the fact that "wait" terminates
with the exit status 0 does not seem to be correct.

-- 
Vincent Lefèvre <vincent@vinc17.net> - 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)


  reply	other threads:[~2017-09-12 14:34 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 ` [BUG] exec + builtin and traps Vincent Lefevre
2017-09-12 10:19   ` Peter Stephenson
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                 ` Vincent Lefevre [this message]
2017-09-12 15:04                   ` trap, eval and wait (was: [BUG] exec + builtin and traps) 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=20170912142145.GA10597@cventin.lip.ens-lyon.fr \
    --to=vincent@vinc17.net \
    --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).