jpluimers / wintee

Automatically exported from code.google.com/p/wintee
0 stars 0 forks source link

output rarely gets displayed when small amount is generated #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. write a script that outputs a line every few seconds;
2. run it, redirecting its output to a file using wtee.

You would expect to see the output to appear when the program generates it, or 
with not much delay. But instead, you do not see anything for a long time on 
the console or in the target file.

I am using wtee 1.0.1 on Windows XP.

It would be great if the buffer was flushed to all targets (console, target 
files) upon receiving new text if a certain amount of time (e.g. 1 or 2 secs) 
have passed since the previous flush.

Original issue reported on code.google.com by kge...@gmail.com on 27 Jun 2013 at 6:14

GoogleCodeExporter commented 8 years ago
Unfortunately it is quite likely not possible - the output generating 
application that is creating the stdout stream is in control. stdout is only 
line buffered on windows if it bis detected as going to an interactive device, 
so once it is piped / redirected to a file, it becomes block buffered. The way 
to overwrite that behaviour is by setting no buffering within the generating 
application, eg
   setvbuf(stdout,NULL,_IONBF,1024);
or by regularly flushing the buffer
   fflush(stdout);
but both of those mean modifying the generating application.

Original comment by nmw01...@googlemail.com on 27 Aug 2014 at 10:26