in reply to Unable to emulate fork functionality on Windows
#!C:\Perl\bin\perl.exe use warnings; use strict; my @drive_dir = ( 'perl /a/dir_file_create.txt', 'perl /b/dir_file_create.txt', 'perl /c/dir_file_create.txt'); my $pid0 = open my $nh, 'type nul |'; # spawn dummy child my @pid; for ( @drive_dir ) { my $pid; $pid = fork and push @pid, $pid; unless( $pid ) { # non-dummy child waitpid $pid0, 0; # wait for dummy child to die system( 'perl $_' ); exit; } } # parent sleep 1; #allow children a little time to start <$nh>; close $nh; # kills dummy child waitpid $_, 0 for ( @pid ); # keep parent alive until all children don +e
One world, one people
|
|---|