Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15754

Re: read -t 0 fails to detect input.

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: read -t 0 fails to detect input.
Date Thu, 19 Dec 2019 08:39:28 +0700
Lines 43
Approved bug-bash@gnu.org
Message-ID <mailman.1121.1576719601.1979.bug-bash@gnu.org> (permalink)
References <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com> <21436.1576719568@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1576719602 6684 209.51.188.17 (19 Dec 2019 01:40:02 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Bize Ma <binaryzebra@gmail.com>
Envelope-to bug-bash@gnu.org
In-Reply-To <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From 2001:3c8:9009:181::2
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <21436.1576719568@jinx.noi.kre.to>
X-Mailman-Original-References <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15754

Show key headers only | View raw


    Date:        Wed, 18 Dec 2019 19:40:45 -0400
    From:        Bize Ma <binaryzebra@gmail.com>
    Message-ID:  <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com>

  | A little delay seems to get it working:
  |
  | $ echo value | { read -t 0 var; } ; echo $?
  | 0

It might, but that is adding no significant delay, and the
results are unpredictable.

jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0

It is all just a race condition - there's nothing specifying which
side of the pipe starts running first.

kre

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: read -t 0 fails to detect input. Robert Elz <kre@munnari.OZ.AU> - 2019-12-19 08:39 +0700

csiph-web