Re: Interactive programs & Teeing



On 11/27/2006 04:09 PM, conrado.blasco@xxxxxxxxx wrote:
I'm trying to write an interactive script that gets commands from
STDIN, prints the results to STDOUT, *and* tees the results to a log
file. [...]

(Well, it actually still prints something, but only when the session is
over.)
[...]

It's best just to open the log file and print twice: once to STDOUT and once to the log file.

The combination of Perl's buffering and tee's buffering result in your inability to get immediate output if STDOUT is sending to tee.


--
paduille.4060.mumia.w@xxxxxxxxxxxxx
.



Relevant Pages

  • Re: Perl 5.8.x, Unicode and In-memory Filehandles
    ... I have just started out experimenting the Unicode capabilities of Perl. ... output buffering with Perl's openin-memory filehandles, ... # Content verified; commit to real STDOUT ... request header) indicates he prefers Big5, ...
    (comp.lang.perl.misc)
  • Re: Using nCurses Inside Existing Program
    ... Before nCurses is instantiated, it is not necessary to flush stdout. ... ncurses change ... the buffering of stdout to block-buffering. ...
    (comp.unix.programmer)
  • Re: order of execution
    ... stdout and stderr are different streams. ... the standard error stream is not fully buffered; ... C defines three buffering modes for streams: ...
    (comp.lang.c)
  • Using WshShell.Exec and retrieving output
    ... The problem is that the program being Exec'd is buffering its output. ... As soon as I did that, I was able to grab the output as it was ... request for stdin, it flushes stdout. ... was now waiting for input is the only reason the text was written to StdOut! ...
    (microsoft.public.scripting.vbscript)
  • Re: Complicated macro...
    ... Just out of curiousity, why is stdout buffering ... Even in situations like this it usually isn't necessary to flush after ... every output operation. ...
    (comp.lang.c)