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

Re: zsh bug in . builtin



Peter Stephenson <pws <at> csr.com> writes:

> Those are all bugs; it's not supposed to ignore errors even in native mode.
> I've taken 128 to mean failed to execute file, 129 to mean failed to find
> file---anyone can suggest better values if unhappy.

I'd much prefer 127 for a missing file (similar to exec), and something < 127
for syntax error (128 and above should typically be for signals).

Also, you may want to consistently detect syntax errors in eval and in the
action to trap:

$ zsh -c 'eval "if"; echo $?'
0
$ zsh -c 'emulate sh; eval "if"; echo $?'
zsh:1: parse error near `if'
1
$ zsh -c 'trap "if" 0'; echo $?
0
$ zsh -c 'emulate sh; trap "if" 0'; echo $?
zsh:1: parse error near `if'
zsh:trap:1: couldn't parse trap command
1
$ zsh -c 'trap "if" 1; kill -1 $$; echo $?'
0
$ zsh -c 'emulate sh; trap "if" 1; kill -1 $$; echo $?'
zsh:1: parse error near `if'
zsh:trap:1: couldn't parse trap command
$ echo $?
1




Messages sorted by: Reverse Date, Date, Thread, Author