in reply to open() with a pipe
Like most programs, Perl's STDOUT is line buffered (flushed on "\n") when connected to a terminal and fully buffered otherwise. $|=1; will turn off STDOUT's buffering.
What if I can't add $|=1 to the first program?
Output buffering is done by the process. The OS is not involved. Therefore, there's nothing you can do about it (unless if provides a mechanism to configure its buffering).
Now, if the child switches to line buffering when connected to a terminal, you could force it to switch by fooling it into thinking it's connected to a terminal. This is done by using a pseudo-tty (pty). IPC::Run gives you easy access to those. If you want to be interactive with the child, maybe Expect is more appropriate.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: open() with a pipe
by 7stud (Deacon) on Nov 30, 2009 at 15:36 UTC |