[GLLUG] read -t 1 hangs on reading from an unconnected pipe.
Tim Woodall
t at woodall.me.uk
Thu Jan 7 09:31:37 UTC 2021
Happy new year to all.
I didn't expect this:
tim at einstein(9):~$ mkfifo /tmp/pipe
tim at einstein(9):~$ time read -t 1 </tmp/pipe
real 0m13.514s
user 0m0.000s
sys 0m0.000s
tim at einstein(9):~$
in another terminal I did:
tim at einstein(10):~$ echo >/tmp/pipe
I had expected the read to time out after one second.
Is there any way to make read always timeout, even if the other end of
the pipe isn't connected?
Tim.
More information about the GLLUG
mailing list