make WebGUI::Config more reliable with relative paths and chdir. fixes forking upgrade.

This commit is contained in:
Graham Knop 2008-09-27 20:07:49 +00:00
parent bb4c576f66
commit ffd685c36a
2 changed files with 23 additions and 14 deletions

View file

@ -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;