/* How to unbuffer the output of a command? Some UNIX commands which use the stdio library are fully buffered (versus line buffered) when they write to a file which is not a tty. This can be a problem when you run command > log 2>&1 and the command hangs and is killed, because not all the output will be in the log. The log would be useful for debugging purposes. Here is a trick from: Casper Dik Compile this C program with: cc -G isatty_preload.c -o isatty_preload.so -Kpic Then use with env LD_PRELOAD=/path/to/isatty_preload.so command > log 2>&1 */ _isatty(int fd) { return 1;}