A common situation is that a program or another writes logging information to stdout, and due to its volume I pipe it through gzip on its way to disk.
Unfortunately gzip and most compression programs like it don't feel obligated to ever flush their output - and if the program freezes, even if it printed a lot of highly relevant debugging information to stdout just before that, and even if it flushed its stdout so gzip got it, gzip will hold to its data indefinitely.
I'd like something like gzip here (uncompressed data on stdin, compressed data to disk) - but that would just flush its output if it isn't getting anything for too long.
I understand that it's possible to build complicated logging system that supports all that - but with this tiny fix of periodic flushing such an extremely simple solution would work just fine.
Is there a program like that, or am I out of luck?