Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Can't get it working: Bidirectional Pipe on Windows

by BrowserUk (Pope)
on Mar 09, 2012 at 12:02 UTC ( #958695=note: print w/replies, xml ) Need Help??

in reply to Re^2: Can't get it working: Bidirectional Pipe on Windows
in thread Can't get it working: Bidirectional Pipe on Windows

No. Look at the definition of winopen2. It dups stdin and stdout to the socket pair prior to starting the child process, so it inherits the sockets as its stdin and stdout; it then restore the originals in the parent once the child is running:

sub winopen2 { my ($pid, $oldin, $oldout); my ($server, $client) = winsocketpair or return undef; open $oldin, '<&', \*STDIN or return (); open $oldout, '>&', \*STDOUT or return (); if (open (STDIN, '<&', $server) and open (STDOUT, '>&', $server)) { $pid = eval { system 1, @_ or die "system command failed: $!"}; # print STDERR "error: $@\n" if $@; } close STDOUT; open STDOUT, '>&', $oldout or carp "unable to reestablish STDOUT"; close STDIN; open STDIN, '<&', $oldin or carp "unable to reestablish STDIN"; #printf STDERR "pid %d, fileno %d, stdout %d, stdin %d\n", # $pid, fileno($client), fileno STDOUT, fileno STDIN; return ($pid and $pid > 0) ? ($pid, $client) : (); }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^4: Can't get it working: Bidirectional Pipe on Windows
by rovf (Priest) on Mar 09, 2012 at 12:33 UTC
    Great! Thanks a lot! I'll give it a try!

    Ronald Fischer <>

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-08-14 19:57 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (155 votes). Check out past polls.