]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/rst.pm
* Add a linkmap plugin (requires graphviz).
[ikiwiki.git] / IkiWiki / Plugin / rst.pm
index 6bf11fe36561c516d1bd10b6e58af34396157df5..789a70ac752b25c2c7aec04d0c79dd61a66f1775 100644 (file)
@@ -39,14 +39,16 @@ sub import { #{{{
        IkiWiki::hook(type => "htmlize", id => "rst", call => \&htmlize);
 } # }}}
 
-sub htmlize ($) { #{{{
-       my $content=shift;
+sub htmlize (@) { #{{{
+       my %params=@_;
+       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 $@;
@@ -62,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