From 62782785086f35b8cb227df3222c4e3edef1d89c Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 15 Sep 2008 21:51:41 +0000 Subject: [PATCH] process upgrade scripts in forks to carry over -I includes and anything else --- sbin/upgrade.pl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl index 1857cf393..ddfd74be6 100644 --- a/sbin/upgrade.pl +++ b/sbin/upgrade.pl @@ -226,12 +226,18 @@ foreach my $filename (keys %config) { } } if ($upgrade{$upgrade}{pl} ne "") { - my $cmd = $perl." ".$upgrade{$upgrade}{pl}." --configFile=".$filename; - $cmd .= " --quiet" if ($quiet); - if (system($cmd)) { - print "\tProcessing upgrade executable failed!\n"; - fatalError(); - } + my $pid = fork; + if (!$pid) { + @ARGV = ("--configFile=$filename", $quiet ? ('--quiet') : ()); + $0 = $upgrade{$upgrade}{pl}; + do $0; + exit; + } + waitpid $pid, 0; + if ($?) { + print "\tProcessing upgrade executable failed!\n"; + fatalError(); + } } $config{$filename}{version} = $upgrade{$upgrade}{to}; $notRun = 0;