Syntactic Confectionery Delight | |
PerlMonks |
fork and open3 on Win32by this_hamster (Initiate) |
on Apr 28, 2001 at 06:19 UTC ( [id://76335]=perlquestion: print w/replies, xml ) | Need Help?? |
this_hamster has asked for the wisdom of the Perl Monks concerning the following question:
In the below perl script, I fork, then have the child start
"cat" via open3(). The child does some I/O with the
"cat" process, then exits. I'm using Cygwin's cat.exe .
This works fine on Unix (perl 5.6.0): $ ./t_iohand2 8629 FORKED 8630 8630: pipe pid = 8631 8630: out: hostinfo 8629 caught 8630: 0 PARENT 8629 exitingHowever, it does this on Win32 (ActiveState Perl 5.6.0-623 and 5.6.1-625):
304 FORKED -1392 am I in cat? #hangs here, so I type in "am I in cat?" to see if this is cat's STDIN/STDOUT am I in cat? #cat repeated the line back (hit ^D here to end cat) Use of uninitialized value in print at t_iohand2 line 35. -1392: pipe pid = 1400 -1392: out: 304 caught -1392: 0 PARENT 304 exiting The process tree for the Win32 output looks like this: 304 -(fork)-> -1392 -(open3)-> 1400 It looks like the STDIN/STDOUT of process 1400 (the open3() child) is getting mixed up with the STDIN/STDOUT of it's parent, -1392. I'm using "cat" as an example here. In the actual script, $CMD is the path to a shell-like program (similar to csh) running on Win32. This works fine on Cygwin perl 5.6.1-1, but my project wants to use ActiveState for a variety of reasons. Thanks for any input!
Back to
Seekers of Perl Wisdom
|
|