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

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



On Sat, Nov 22, 2014 at 7:01 PM, Daniel Hahler <dhahler@xxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 22.11.2014 18:51, Mikael Magnusson wrote:
>>> I am using a precmd hook to setup my prompt and call "vcs_info 'prompt'" from there.
>>>
>>> When starting an interactive Git rebase, while the editor is still open, it will fail as follows:
>>>
>>>     VCS_INFO_get_data_git:208: no such file or directory: .git/rebase-merge/done
>>>
>>> While this bug can be fixed (I'll post a patch), I think it's still a bug that vcs_info aborts the precmd.
>>>
>>> Why is that?
>>>
>>> I have tried adding "set +e" and "|| true" before the call to vcs_info, but without success.
>>
>> http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=33671 should fix
>> this already.
>
> Yes, it's likely to fix this, although it might not be necessary to replace that many occurrences.
> Also, I don't know if "$(cat ..)" is as efficient as "$(< ..)". Does it use a subshell, or is it optimized?
>
> 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'm not sure if that's a bug or not since it's
documented to not be the case. (in Command Substitution,
   The substitution `$(cat foo)' may be replaced
   by  the  equivalent but  faster  `$(<foo)'.
)

-- 
Mikael Magnusson



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