fork a child to run dumpsetup
parent
8ce11b51f8
commit
d4c11466ba
|
@ -51,9 +51,7 @@ sub load ($;$) {
|
|||
sub dump ($) {
|
||||
my $file=IkiWiki::possibly_foolish_untaint(shift);
|
||||
|
||||
eval qq{require IkiWiki::Setup::$config{setuptype}};
|
||||
error $@ if $@;
|
||||
my @dump="IkiWiki::Setup::$config{setuptype}"->gendump(
|
||||
my @header=(
|
||||
"Setup file for ikiwiki.",
|
||||
"",
|
||||
"Passing this to ikiwiki --setup will make ikiwiki generate",
|
||||
|
@ -62,9 +60,23 @@ sub dump ($) {
|
|||
"Remember to re-run ikiwiki --setup any time you edit this file.",
|
||||
);
|
||||
|
||||
# Fork because dumping setup requires loading all plugins.
|
||||
my $pid=fork();
|
||||
if ($pid == 0) {
|
||||
eval qq{require IkiWiki::Setup::$config{setuptype}};
|
||||
error $@ if $@;
|
||||
my @dump="IkiWiki::Setup::$config{setuptype}"->gendump(@header);
|
||||
|
||||
open (OUT, ">", $file) || die "$file: $!";
|
||||
print OUT "$_\n" foreach @dump;
|
||||
close OUT;
|
||||
|
||||
exit 0;
|
||||
}
|
||||
else {
|
||||
waitpid $pid, 0;
|
||||
exit $? if $?;
|
||||
}
|
||||
}
|
||||
|
||||
sub merge ($) {
|
||||
|
|
Loading…
Reference in New Issue