I have an xterm window that I would like to continually display the output of a named pipe. However, there seems to be some buffering occurring, and I can't find where it is happening.
I open two terminals. In the first, I make a pipe and watch for anything sent to it.
mkfifo pipe tail -f pipe
On the second terminal, I send two messages through the pipe, from a single process, separated by some time. I use
stdbuf to make sure that the output of the command is unbuffered.
stdbuf -o0 bash -c 'echo hi; sleep 5; echo bye' > pipe
This works as expected, with the first terminal printing
hi, then printing
bye five seconds later.
However, if I run the
tail -f pipe inside an xterm window, then the messages do not appear until the program exits. Clearly, there is some buffering being done, but I cannot find where it is. Is there a way to prevent xterm from buffering the output of programs?
My "normal terminal" uses PuTTY, ssh-ed from Windows 7 to Linux machine. On the Linux machine,
uname -a returns
Linux hostname 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux, and
xterm -v returns