Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Synchronizing STDERR and STDOUT

by nothingmuch (Priest)
on Sep 21, 2006 at 11:20 UTC ( #574104=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Synchronizing STDERR and STDOUT
in thread Synchronizing STDERR and STDOUT

You missed my point.

The shell will simply do a dup of 2>&1 like i illustrated. The problem is not in the fork, etc, but in that the sugar layer to do this dup, namely 2>&1 involves reparsing the command line, etc, and is thus undesirable and unportable.

Instead of staying one level above backticks and shell redirects, you can simply do what they do.

As for fork vs no fork - look at how IPC::Run does it. It's portable to windows and supports redirects.

WRT synching - i am not sure (this may be impl dependant) but if there are two separate buffers for the predupped handled then they won't be in synch unless you auto flush in the child. If two dupped file descriptors will share a buffer then they will be completely synchronized, and in either case this is not going to be any different than what 2>&1 will give you.

-nuffin
zz zZ Z Z #!perl


Comment on Re^5: Synchronizing STDERR and STDOUT
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://574104]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-07-31 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (246 votes), past polls