mkaiser67 has asked for the wisdom of the Perl Monks concerning the following question:
why would the fork() interfere with the results from the backticks in line 8? I know this is happening because the following code does work correctlymy @dirs = ( "/path1", "/path2",... ); foreach my $dir (@dirs) { next unless -d $dir; my @makelists = `find $dir -name .makelist`; foreach my $file (@makelists) { my $kidpid = fork(); if($kidpid == 0){ # Child here if (-e "$dir/$file") { ProcessMakeList($file); } else { print "bad $file\n"; } exit 0; } } }
my @dirs = ( "/path1", "/path2",... ); foreach my $dir (@dirs) { next unless -d $dir; my $kidpid = fork(); if($kidpid == 0){ # Child here my @makelists = `find $dir -name .makelist`; foreach my $file (@makelists) { if (-e "$dir/$file") { ProcessMakeList($file); } else { print "bad $file\n"; } } exit 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fork() interferring with backtick
by Eily (Monsignor) on Oct 16, 2013 at 16:29 UTC | |
by mkaiser67 (Initiate) on Oct 16, 2013 at 18:30 UTC | |
by vsespb (Chaplain) on Oct 16, 2013 at 19:19 UTC | |
|
Re: fork() interferring with backtick
by vsespb (Chaplain) on Oct 16, 2013 at 17:11 UTC | |
by mkaiser67 (Initiate) on Oct 16, 2013 at 18:37 UTC | |
by vsespb (Chaplain) on Oct 16, 2013 at 19:14 UTC | |
by mkaiser67 (Initiate) on Oct 17, 2013 at 19:02 UTC | |
|
Re: fork() interferring with backtick
by Laurent_R (Canon) on Oct 16, 2013 at 16:54 UTC |