gbs cleanup patch, 2nd try
Andrew Schulman
andrex@alumni.utexas.net
Sat Oct 30 07:36:00 GMT 2004
>> Great. Have you tested whether the -e flag gets propagated inside the
>> functions?
>
> Yes, I have now:
>
> $ /bin/sh -e ; echo "finished /bin/sh -e, status=$?"
> $ echo $-
> eims
> $ # the -e flag propagates into subshells:
> $ tst1() { echo $- ; }
> $ tst1
> eims
> $ # false result inside a function causes subshell and
> $ # main shell to immediately exit:
> $ tst2() { false ; echo "continuing execution" ; }
> $ tst2
> finished /bin/sh -e, status=1
Sorry, the above is wrong:
$ /bin/sh -e ; echo "finished /bin/sh -e, status=$?"
$ ( echo $- )
ehimBH
$ ( false ; echo "continuing execution" )
$ echo $?
1
So -e is effective in the subshell, but when it returns its false status it
doesn't cause its parent shell to exit. I now see in the manual that this is
because a subshell isn't a "simple command".
So I will have to rethink how best to handle a false return status of a
subshell.
More information about the Cygwin-apps
mailing list