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

Re: zsh syntax check fails on correct if [[ usage (rhbz 966911)



On Fri, 18 Oct 2013 16:33:36 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> It looks like when $(...) doesn't run anything
> because of NO_EXEC it's keeping the status value from the parent shell,
> which isn't useful.  (That's where the test above comes into the problem
> --- it's setting the internal status to 1.)  I think we need to
> initialise the status to 0 after the fork. 

No, that's not right, and there's a check for it in D08cmdsubst.ztst.

 false
 echo `echo $?`
0:Non-empty command substitution inherits status
>1

We *do* need to inherit the status.  To go down this route we'd need
to detect that nothing was being executed and set the status explicitly
to zero, which we do in some cases, but not for NOEXEC.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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