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:27:50 +0100	[thread overview]
Message-ID: <AANLkTi=ZzYr4RPVSME=3B3YSnd2G_tvYaG9G8=Xz5R4c@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimsL-iNb6oeSS3OiDQ-yRQQCmVs6om5yGAh40Du@mail.gmail.com>

On 11 January 2011 04:25, Mikael Magnusson <mikachu@gmail.com> wrote:
>>    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

One might take issue with this statement in the manpage though,

The  functions  beginning  `TRAP'  may alternatively be defined with the trap
builtin:  this may be preferable for some uses, as they are then run  in  the
environment  of  the calling process, rather than in their own function envi‐
ronment.  Apart from the difference in calling procedure and  the  fact  that
the function form appears in lists of functions, the forms

              TRAPNAL() {
               # code
              }

       and

              trap '
               # code
              ' NAL

       are equivalent.


-- 
Mikael Magnusson


  reply	other threads:[~2011-01-11  3:28 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
2011-01-11  3:27           ` Mikael Magnusson [this message]
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='AANLkTi=ZzYr4RPVSME=3B3YSnd2G_tvYaG9G8=Xz5R4c@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).