Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: exit status
- X-seq: zsh-workers 22996
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: exit status
- Date: Fri, 10 Nov 2006 21:28:44 -0800
- In-reply-to: <200611101609.kAAG9ArT019938@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200611100940.kAA9ewZY012583@xxxxxxxxxxxxxx> <061110075808.ZM4615@xxxxxxxxxxxxxxxxxxxxxx> <200611101609.kAAG9ArT019938@xxxxxxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author