named pipes: handle reads when isFifo
odeke-em opened this issue · 1 comments
odeke-em commented
Reading from a named pipe with no content will hang infinitely until content is passed in.
Simple test here:
$ fifoPath=testPipe
$ mkfifo $fifoPath
$ sleeper() { i=0;while [ $i -lt 20 ];do echo -e "sleeping $i\r"; let i=i+1;sleep 1;done; echo "done here $i" >> $fifoPath; }
$ sleeper & # Put it in the background
$ cat $fifoPath # Going to hang for the 20 seconds -- this can happen infinitely