in reply to Re^2: pipe fork win32
in thread pipe fork win32
I read select but why?
All the debuf() does is apply $|++ to $parent, thus making the handle line-buffered rather than block buffered.
Hence, the \n in print $parent "exit now\r\n\r"; causes the buffer to be flushed through and the read then completes.
(BTW: The \rs do nothing! As the pipe is in text mode, the \n will be translated to \cM\cJ on write and then back to \cJ when read back.)
why would changing the default handle affect it?
if you look closely at debuf(), it selects the handle ($parent) that is passed to it; does the $++ whilst that handle is selected, and then re-selects the original default handle. Ie. It is equivalent to:
sub debuf{ my $old = select( $_[0] ); $|++; select( $old } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: pipe fork win32
by bulk88 (Priest) on Aug 26, 2012 at 19:36 UTC | |
by BrowserUk (Patriarch) on Aug 26, 2012 at 20:18 UTC |