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

Re: strange interaction between read command and pipe to less from function



On Sun, Mar 26, 2023 at 7:04 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> Now I'm totally confused.  A bit by your answer and the word 'simultaneously'
> as I thought the function would run first then less.

When you run `cvt_256_colors_2_rgb_hex_fmt | less`, two processes run
simultaneously. One is executing `cvt_256_colors_2_rgb_hex_fmt`, the
other is executing `less`.

> I hope you are not as confused as I am.

I am not. When two commands simultaneously write and read the same
TTY, anything goes. By adding something to the function you've changed
the timings, so now the race condition manifests differently.

Roman.




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