I have one program writing to mkfifo created device 7 lines of text data every 3 seconds using printf()
. I am trying to read it with cat /path/to/device
in another terminal window. But instead of updating every 3 seconds, it will print something only once every 25 seconds. Why? How to make it update faster? (Ubuntu Wily)
-
are you using concurrency with other shells scripts ?– deimusCommented Dec 7, 2015 at 13:47
Add a comment
|
1 Answer
One or both ends of the pipe is buffering more than you want. In your writing program, fflush
when you finish writing your 7 lines, and read the output with cat -u
(if your cat
is not GNU cat).