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, 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.

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.



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