egarland has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to create a program that manages child processes by sending data to their standard in and monitoring the output from stdout. It works great on Unix and even under cygwin but it dies horribly under ActivePerl for Windows (5.8-5.8.3). I've created this sample script which demonstrates the problem:
Under unix and cygwin you get the expected bahavior, a file test.txt with "child" in it and the program prints "parent" as it's output. Under Windows I get no output and a file that has both "hi" and "parent" in it. From what I've read about fork emulation under Windows it sounded like this should work. In fact, if I try the example listed in perlfork under Windows it doesn't work! Does anyone know what's going on here?if ($pid=fork() ) { select(undef,undef,undef,.1); print "parent\n"; } else { open (STDOUT, ">test.txt"); system("echo child"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Windows filehandles and fork
by Koosemose (Pilgrim) on Apr 09, 2004 at 01:18 UTC | |
by egarland (Acolyte) on Apr 09, 2004 at 02:45 UTC | |
by egarland (Acolyte) on Apr 09, 2004 at 06:36 UTC | |
by Koosemose (Pilgrim) on Apr 09, 2004 at 06:53 UTC | |
by egarland (Acolyte) on Apr 13, 2004 at 12:14 UTC | |
Re: Windows filehandles and fork
by Koosemose (Pilgrim) on Apr 09, 2004 at 07:26 UTC | |
Re: Windows filehandles and fork
by esskar (Deacon) on Apr 09, 2004 at 01:19 UTC | |
by bart (Canon) on Apr 09, 2004 at 08:07 UTC | |
Re: Windows filehandles and fork
by sgifford (Prior) on Apr 09, 2004 at 14:46 UTC |
Back to
Seekers of Perl Wisdom