]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Add proper waitpid calls for open2ed processes throughout to avoid
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 3 Sep 2006 20:11:39 +0000 (20:11 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 3 Sep 2006 20:11:39 +0000 (20:11 +0000)
  zombies; this hit htmltidy especially badly.

IkiWiki/Plugin/htmltidy.pm
IkiWiki/Plugin/otl.pm
IkiWiki/Plugin/rst.pm
debian/changelog

index 079da7b493d29d84b6ffdba6d4d06f0498ec88ec..c626250cba0c8efcecc21b7f82b29abcb2aaed96 100644 (file)
@@ -20,9 +20,10 @@ sub sanitize (@) { #{{{
        my %params=@_;
 
        my $tries=10;
+       my $pid;
        while (1) {
                eval {
-                       open2(*IN, *OUT, 'tidy -quiet -asxhtml -utf8 --show-body-only yes --show-warnings no --tidy-mark no');
+                       $pid=open2(*IN, *OUT, 'tidy -quiet -asxhtml -utf8 --show-body-only yes --show-warnings no --tidy-mark no');
                };
                last unless $@;
                $tries--;
@@ -39,7 +40,11 @@ sub sanitize (@) { #{{{
        close OUT;
 
        local $/ = undef;
-       return <IN>;
+       my $ret=<IN>;
+       close IN;
+       waitpid $pid, 0;
+
+       return $ret;
 } # }}}
 
 1
index be339c88ebee44b77371422822ae4816a102cd5e..0cd93a3ecc773248e82e9180f7ae8a6c319198fa 100644 (file)
@@ -31,9 +31,10 @@ sub htmlize (@) { #{{{
        my %params=@_;
 
        my $tries=10;
+       my $pid;
        while (1) {
                eval {
-                       open2(*IN, *OUT, 'otl2html -S /dev/null -T /dev/stdin');
+                       $pid=open2(*IN, *OUT, 'otl2html -S /dev/null -T /dev/stdin');
                };
                last unless $@;
                $tries--;
@@ -51,6 +52,9 @@ sub htmlize (@) { #{{{
 
        local $/ = undef;
        my $ret=<IN>;
+       close IN;
+       waitpid $pid, 0;
+
        $ret=~s/.*<body>//s;
        $ret=~s/<body>.*//s;
        $ret=~s/<div class="Footer">.*//s;
index 08ac15e43fb419b05e2a5d718c266b44c7bb4a50..789a70ac752b25c2c7aec04d0c79dd61a66f1775 100644 (file)
@@ -44,10 +44,11 @@ sub htmlize (@) { #{{{
        my $content=$params{content};
 
        my $tries=10;
+       my $pid;
        while (1) {
                eval {
                        # Try to call python and run our command
-                       open2(*IN, *OUT, "python", "-c",  $pyCmnd)
+                       $pid=open2(*IN, *OUT, "python", "-c",  $pyCmnd)
                                or return $content;
                };
                last unless $@;
@@ -63,8 +64,13 @@ sub htmlize (@) { #{{{
        
        print OUT $content;
        close OUT;
+
        local $/ = undef;
-       return <IN>;
+       my $ret=<IN>;
+       close IN;
+       waitpid $pid, 0;
+
+       return $ret;
 } # }}}
 
 1
index cf8a1bbf713c9a7438a7defff28523a0460181fc..39b2e829bdea23bc4b8e4f61d13c2e1df7bbec87 100644 (file)
@@ -1,3 +1,10 @@
+ikiwiki (1.25) UNRELEASED; urgency=low
+
+  * Add proper waitpid calls for open2ed processes throughout to avoid
+    zombies; this hit htmltidy especially badly.
+
+ -- Joey Hess <joeyh@debian.org>  Sun,  3 Sep 2006 15:56:55 -0400
+
 ikiwiki (1.24) unstable; urgency=low
 
   * Simplify the data structure returned by rcs_recentchanges to avoid