zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Anthony Heading <anthony@ajrh.net>
Cc: zsh-workers@zsh.org
Subject: Re: 4.3.11 TRAPEXIT() on cygwin
Date: Tue, 11 Jan 2011 04:25:01 +0100	[thread overview]
Message-ID: <AANLkTimsL-iNb6oeSS3OiDQ-yRQQCmVs6om5yGAh40Du@mail.gmail.com> (raw)
In-Reply-To: <1294714469.3446.1414534693@webmail.messagingengine.com>

On 11 January 2011 03:54, Anthony Heading <anthony@ajrh.net> wrote:
> On Tue, 11 Jan 2011 02:50 +0100, "Mikael Magnusson" <mikachu@gmail.com>
> wrote:
>> > echo $( trap 'echo exiting' EXIT)
>> >
>> > or similar substitutions.  That's quite clearly a subshell entering to
>> > the same extent a ( ... ) is.
>>
>> How is that different from what you wrote?
>
> Well, the examples you quote are traps set within a subshell, which may
> or may not propagate higher.
>
> My problem is that the subshell is inheriting the parent trap action.
>
> That seems obviously different, and POSIX seems pretty clear:
>
>    When a subshell is entered, traps that are not being ignored shall
>    be set to the default actions, except in the case of a command
>    substitution containing only a single trap command, when the traps
>    need not be altered.

Ah, the manpage says this
       ( list )
              Execute  list  in a subshell.  Traps set by the trap
builtin are reset
              to their default values while executing list.

and it is true:
% trap 'echo hello >&2' EXIT
% a=$(ls)
% TRAPEXIT() { echo function hello >&2 }
% a=$(ls)
function hello

-- 
Mikael Magnusson


  reply	other threads:[~2011-01-11  3:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11  0:16 Anthony Heading
2011-01-11  0:46 ` Mikael Magnusson
2011-01-11  1:46   ` Anthony Heading
2011-01-11  1:50     ` Mikael Magnusson
2011-01-11  2:54       ` Anthony Heading
2011-01-11  3:25         ` Mikael Magnusson [this message]
2011-01-11  3:27           ` Mikael Magnusson
2011-01-11  9:38             ` Peter Stephenson
2011-01-11 15:38               ` Bart Schaefer

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=AANLkTimsL-iNb6oeSS3OiDQ-yRQQCmVs6om5yGAh40Du@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=anthony@ajrh.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).