bug-bash
[Top][All Lists]
Advanced

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

Re: CORRECTED: Bug in the read command


From: Chet Ramey
Subject: Re: CORRECTED: Bug in the read command
Date: Thu, 18 Sep 2025 14:55:36 -0400
User-agent: Mozilla Thunderbird

On 9/17/25 12:02 PM, pourko@tutamail.com wrote:
As a side question, wouldn't it make more sense if read -d"" -t 0
makes the read in raw mode?

What would that do to change things? (I assume that you mean a non-
blocking read; `raw mode' has historically meant something different.)

 Or is it carved in stone for historical
reasons? If so, then couldn't we maybe some time in the future get
a new "-T 0" option that could do a read in raw mode? Because, as
things are now, one has no way to check from within a tight loop
whether some key has been pressed -- not without a wasteful timeout
option, or without an expensive external call to set the term raw.

So you're worried about what is essentially typeahead into the kernel's
input buffer? If there really is typeahead there, `read -t 0', which
uses select or FIONREAD, will tell you. Then you can choose how to
handle it, probably by reading one 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/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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