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

Re: zsh behavior when fork() failed



On Fri, Feb 24, 2012 at 11:35 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 24,  4:38pm, Dipak Gaigole wrote:
> }
> } As we can see that zsh continues even if it knows that it has failed
> } in fork and finally the script return status is 0.
>
> The script return status is zero because the last command it executed
> was successful.  That has nothing to do with the rest of the question.
>
Yes, I understand.

> } Also checking for $? after each command is not feasible. So doesn't
> } this zsh behavior looks misleading?
>
> Depends on whether fork failure is supposed to be fatal to the shell.
> I looked at:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
>
> Section 2.8.1 lists command execution failures where a non-interactive
> shell "shall exit", but fork failure is not among them.

Got it. But I don't want to add a check of $? after each command in
the scripts specially in cases where scripts are 1000+ lines.

Is there any zsh option to make sure script exit when fork fails? Else
can I patch the zsh code to make script exit on fork failure?

Thanks,
Dipak



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