Michał Górny wrote:
> ( source "${f}" || die "sourcing ${f} failed" )
>
> 2b. Unless someone knows a way around this, this means that the check
> -- unless 'die'-fatal -- needs to ensure non-zero status of last
> comment, likely via some trailing 'true' or ':'. Since we can't
> distinguish between non-zero return from script and non-zero exit
> due to syntax error or so.Just a nit that the subshell needs to exit 0, not non-zero. 0 is success, non-zero is error. The calling could be expanded and there could be a contract about different exit codes meaning different things. Since "we" control both sides of this contract it's not limited to a binary result. > 3b. We really do want to legalize die in subshells. We can't live > without it anyway, so why pretending it's illegal? Why would it be? If something is a fatal error then it is a fatal error. I guess one reason might be that die should only be called in the top level, but that's also easy enough.. Just exit 1 instead of die within the subshell. > What do you think? I like it. //Peter
pgpO2u6wkUhDh.pgp
Description: PGP signature
