[tpm] buffering problem on input from shell command

John Macdonald john at perlwolf.com
Sun Mar 9 21:27:25 PDT 2008

On Sun, Mar 09, 2008 at 10:41:04PM -0400, Madison Kelly wrote:
> John Macdonald wrote:
>> The problem will be that the output is being buffered by the program that 
>> is writing the data you are trying to read.  That program collects
>> a full buffer of data before it writes it out into the pipeline.  No
>> matter how fast you read the other end of the pipe, you can't read the
>> parts that are still in the other programs buffer and not yet written
>> - unless you have access to the code of that program to set its output
>> buffering to unbuffered.
> In my case, I've tested by running the same command on another shell and 
> the output was instant. In fact, it's by DBus's design that signals get 
> sent ASAP, so I am not sure that the program is buffering in this case.
> Is there any way in particular I could test for this?
> Madi

I think the default buffering is unbuffered if the output is going to
the terminal, but buffered if it is going to a file or pipe.  I don't
know if there is a way around that without getting into the source 

More information about the toronto-pm mailing list