Re: procsub doesn't release the terminal without reading one byte
From:
Chet Ramey
Subject:
Re: procsub doesn't release the terminal without reading one byte
Date:
Sat, 12 Oct 2024 20:18:18 -0400
User-agent:
Mozilla Thunderbird
On 10/9/24 2:01 PM, Oğuz wrote:
The first letter I type after running this command won't show up on
the terminal:
: < <(cat)
This is reproducible on 5.3 beta too.
It's cat and the scheduler. You have two processes fighting over stdin.
cat inherits stdin, and successfully reads one character, because its
read returns successfully before readline's pselect returns indicating
that there is input and readline calls read.
cat tries to write the character to an invalid fd (the pipe is gone), gets
-1/EPIPE/SIGPIPE, and dies in the background.
Readline calls read and successfully reads the next character.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/