bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read() may fail due to nonblocking stdin


From: Chet Ramey
Subject: Re: read() may fail due to nonblocking stdin
Date: Mon, 23 Jan 2017 10:45:26 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 1/23/17 10:42 AM, Chet Ramey wrote:
> On 1/22/17 2:32 PM, Siteshwar Vashisht wrote:
>> If a child process sets stdin to non-blocking and does not set it back to 
>> blocking before exiting, other processes may fail to read from stdin.
> 
> It's not the shell's business to be resetting this for processes it spawns.
> What bash should do is to turn of O_NONBLOCK when it reads input, which it
> already does at startup but not every time it calls readline().

And maybe I should make the follow-up point explicit: that will fix this
problem, too.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]