Greg Wooledge wrote: > Linda Walsh wrote: > > Bob Proulx wrote: > > >This may be a good point to mention this reference: > > > > > > http://www.pixelbeat.org/programming/stdio_buffering/ > > > Does it only work with gnu programs? I.e. how would they know to > > not buffer > > Sounds like the GNU version of "unubuffer" from the Tcl expect package. > http://expect.sourceforge.net/
Similar in result. Different in implementation. The unbuffer expect script sets up a tty around the called program so that instead of a pipe the program detects a tty. Programs that normally do not buffer when writing to a tty will then work as if they were interactive even if they were not. Wrapping commands is a core functionality of expect scripts and so unbuffer is using it for the side-effect. The stdbuf utility works by setting up an LD_PRELOAD library libstdbuf.so that replaces the libc calls and intercepts and overrides the calls to do buffering. Bob