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

Re: A function to display message under the prompt without zle active

On Sat, 22 Jun 2019 at 23:17, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
> On Sat, Jun 22, 2019 at 10:49 PM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > The command line seems to be blcoked after first using the descriptor.
> Silly bugs. This isn't production code, I just typed it into GMail to
> give an idea. Removing `while` should fix it. There is also a missing
> `local` and quotes. With these fixes in place:
>     function _zle_msg_process() {
>       emulate -L zsh
>       local line
>       IFS='' read -r -u $zle_msg_fd line && zle -M $line
>     }
> The rest of the code stays the same. The nice thing about this
> implementation is that it's fork-free.

Thanks for the code, this distinct property might get handy in some situations.

> Depending on your needs you might also want to open the file descriptor
> with `sysopen -rw -o cloexec`.
> Note that zle will hang if you write something to the file descriptor
> without a terminating \n.
> Roman.

Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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