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

Re: [BUG] exec + builtin and traps



On 2017-09-12 12:51:39 +0100, Peter Stephenson wrote:
> On Tue, 12 Sep 2017 13:42:20 +0200
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > BTW, the way zsh handles "eval" is still strange:
> > 
> > ----------------------------------------
> > trap 'echo foo' USR1
> > ( sleep 1; kill -USR1 $$; ) &
> > eval "wait && echo bar"
> > echo OK
> > ----------------------------------------
> > 
> > outputs
> > 
> > foo
> > bar
> > OK
> 
> That'll be another effect of NO_ASYNC_TRAPS --- the list being executed
> is what's in quotes, and it's after that that the trap gets run.

Why is "foo" (from the trap) printed before "bar", then?

> I don't think NO_ASYNC_TRAPS behaviour is standardised.

That's another reason why it would be useful to clearly document
when traps are run precisely.

-- 
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