zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.57k stars 1.88k forks source link

Manipulating file descriptors and triggering a parse error produces error #800

Open Iori-Pimentel opened 3 months ago

Iori-Pimentel commented 3 months ago

Describe the bug

My .zshrc has a zshaddhistory hook that can cause this error message:

_zsh_autosuggest_async_request:zle:9: No handler installed for fd 12

To Reproduce

Steps to reproduce the behavior:

% zsh -df
% add-zsh-hook zshaddhistory hook
% hook() {
function> { exec {FD}>/dev/null } 2>/dev/null
function> }
% )
zsh: parse error near `)'
% )
_zsh_autosuggest_async_request:zle:9: No handler installed for fd 12

Expected behavior

No error message

Additional Context

Error message can be suppressed by adding 2>/dev/null to

        zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD
Iori-Pimentel commented 3 months ago

Found out that hook is unneccesary to reproduce bug. This seems enough:

% { exec {FD}</dev/null } 2>/dev/null