diff options
author | Joey Hess <joey@kitenet.net> | 2010-07-08 13:55:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-08 13:55:30 -0400 |
commit | d4c11466bad0e0aa3ac3c6f0bfc7577633d0d744 (patch) | |
tree | feebfb691eb3620ee3f5f9e164f75fd43779302a /IkiWiki | |
parent | 8ce11b51f85a08e6dd426b3855b06e5e3ce09f55 (diff) | |
download | ikiwiki-d4c11466bad0e0aa3ac3c6f0bfc7577633d0d744.tar ikiwiki-d4c11466bad0e0aa3ac3c6f0bfc7577633d0d744.tar.gz |
fork a child to run dumpsetup
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Setup.pm | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 2b0259e2a..5b77a6471 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -50,10 +50,8 @@ 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.", ); - open (OUT, ">", $file) || die "$file: $!"; - print OUT "$_\n" foreach @dump; - close OUT; + # 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 ($) { |