gw1500se has asked for the wisdom of the Perl Monks concerning the following question:

I am making some progress with IPC::Run but I still cannot get what I really want. Even though I am using pump_nb, it still blocks until the command completes. I am guessing this is a buffering issue. I saw documentation that says the input stream is automatically flushed but it says nothing about the output. Assuming my guess is correct (I hope someone will confirm that or explain what is happening) then is there a way to automatically flush the output buffer. My script needs to see any output when it is immediately available since the command is long running and operator action may need to be taken. Thanks.

Replies are listed 'Best First'.
Re: Another IPC::Run Question
by ikegami (Patriarch) on Jul 10, 2008 at 23:00 UTC

    The child buffering its output would indeed account for the behaviour you're observing. Unfortunately, you can't do much about it (unless you control the source of the child). Whether the child buffers its output or not it is outside of the parent's control.

      Rats! Thanks for the reply. I guess it is back to the drawing board.
        You could try creating a Psudo TTY (IPC::Run has native support for doing that, IIRC). That may convince the child to flush its buffers at the end of every line.