in reply to Re^3: Win32 Perl: inheriting redirected STDIN and STDOUT in a child process (select)
in thread Win32 Perl: inheriting redirected STDIN and STDOUT in a child process
Win32::Socketpair did the trick. Apparently pipes aren't handled well when redirecting STDIO.
The module does exactly the same thing to redirect the STDIN/STDOUT that I tried without success. The big difference was that it was using a network socket instead of a pipe.
For the record, I did have to set the handles to autoflush in both the client and server code in order for things to work properly.
Thanks for your help.
# In the server: use IO::Handle; my @command = ( 'perl', 'client.pl' ); my ($started, $fd)= winopen2( @command ); $fd->autoflush; # and the client: use IO::Handle; STDIN->autoflush; STDOUT->autoflush; print "$_" while <>;
TGI says moo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Win32 Perl: inheriting redirected STDIN and STDOUT in a child process (select)
by BrowserUk (Patriarch) on Oct 23, 2008 at 17:36 UTC |