zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: exit status
Date: Fri, 10 Nov 2006 21:28:44 -0800	[thread overview]
Message-ID: <061110212844.ZM5583@torch.brasslantern.com> (raw)
In-Reply-To: <200611101609.kAAG9ArT019938@news01.csr.com>

Aside:  Here's an actual bug:

   zsh -fc 'trap "echo \$?" EXIT; echo ${example?oops}'

The EXIT trap is not called when the shell exits on the error caused
by the ${var?message} construct.  (Bash prints "127" in this case;
also, the exit status of zsh on that construct is 1 rather than 127,
but I don't know why bash chose 127.)

On Nov 10,  4:09pm, Peter Stephenson wrote:
}
} I can see arguments for both sides; it turns whether you consider the
} "exit" command itself to have been executed before the exit traps run,
} which is a bit Zen-like.

Think of it as a C program.  If

    int question_mark = 0;
    atexit() { printf("%d\n", question_mark); }
    main() { question_mark = exit(3); }

is a valid program and, when run, prints "3", then I'm on your side.
Otherwise I'm with Cragun.


  reply	other threads:[~2006-11-11  5:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10  9:40 Peter Stephenson
2006-11-10 15:58 ` Bart Schaefer
2006-11-10 16:09   ` Peter Stephenson
2006-11-11  5:28     ` Bart Schaefer [this message]
2006-11-11 13:13       ` 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=061110212844.ZM5583@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).