]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/UserInfo.pm
* Add mirrorlist plugin.
[ikiwiki.git] / IkiWiki / UserInfo.pm
index 34f05203a10f2367f7f583ce7d6365da1cd8c6d0..5c9d7dce686a86f0527585e92d017cc3c632b313 100644 (file)
@@ -141,15 +141,17 @@ sub send_commit_mails ($$$@) { #{{{
                );
 
                # Daemonize, in case the mail sending takes a while.
+               defined(my $pid = fork) or error("Can't fork: $!");
+               return if $pid;
+               setsid() or error("Can't start a new session: $!");
                eval q{use POSIX ’setsid’};
                chdir '/';
                open STDIN, '/dev/null';
                open STDOUT, '>/dev/null';
-               defined(my $pid = fork) or error("Can't fork: $!");
-               return if $pid;
-               setsid() or error("Can't start a new session: $!");
                open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
 
+               unlockwiki(); # don't need to keep a lock on the wiki
+
                eval q{use Mail::Sendmail};
                error($@) if $@;
                foreach my $email (@email_recipients) {
@@ -160,6 +162,8 @@ sub send_commit_mails ($$$@) { #{{{
                                Message => $template->output,
                        ) or error("Failed to send update notification mail");
                }
+
+               exit 0; # daemon process done
        }
 } #}}}