Linux non-blocking fifo (on demand logging)
I like to log a programs output 'on demand'. Eg. the output is logged to the terminal, but another process can hook on the current output at any time. The classic way would be: myprogram 2>&1 | tee /tmp/mylog and on demand tail /tmp/mylog However, this would create a ever growing log file even if not used until the drive runs out of space. So my attempt was: mkfifo /tmp/mylog myprogram 2>&1 | tee /tmp/mylog and on demand cat /tmp/mylog Now I can read /tmp/mylog at any time. However, any output blocks the program until the /tmp/mylog is read. I like the fifo to flush any incoming data not read