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

Re: [PATCH] avoid closed stdin() in zle widgets

On 06/11/2017 02:20 PM, Stephane Chazelas wrote:
> Hello,
> in zle widgets, stdin currently appears to be closed. That's
> generally not a good idea to close fds 0, 1, 2 as many commands
> are confused when the files they open suddenly become their
> stdin/stdout/stderr because the first free fd is 0/1/2.
> See
> https://unix.stackexchange.com/q/370475

It is documented to work like that in zshzle

       User-defined  widgets,  being implemented as shell functions, can execute any normal shell command.  They can also run other
       widgets (whether built-in or user-defined) using the zle builtin command.  The standard input of the function is  closed  to
       prevent external commands from unintentionally blocking ZLE by reading from the terminal, but read -k or read -q can be used
       to read characters.  Finally, they can examine and edit the ZLE buffer being edited  by  reading  and  setting  the  special
       parameters described below.

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