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

Re: BUG: failure in "vcs_info prompt" aborts precmd function



On Sun, Nov 23, 2014 at 4:58 PM, Daniel Hahler <dhahler@xxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 22.11.2014 23:20, Mikael Magnusson wrote:
>
>>> Apart from that, I am still wondering why the error in vcs_info causes abortion of the precmd function?!
>>
>> Passing a non-existing file to $(< is a fatal error, or whichever term
>> is correct here.
>
> I got that, but e.g. `false` does not abort the precmd function.

Yes, a command that returns false is not a fatal error. In the
meantime you can do this to work around the problem.
% { $(< foo) }; echo hello
zsh: no such file or directory: foo
% { $(< foo) } always { TRY_BLOCK_ERROR=0 }; echo hello
zsh: no such file or directory: foo
hello

eg, call vcs_info inside the first { }. However, I'm not sure how to
make the construct return false when it failed with a fatal error.

-- 
Mikael Magnusson



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