diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/htmltidy.pm | 9 | ||||
-rw-r--r-- | IkiWiki/Plugin/otl.pm | 6 | ||||
-rw-r--r-- | IkiWiki/Plugin/rst.pm | 10 |
3 files changed, 20 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index 079da7b49..c626250cb 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -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 diff --git a/IkiWiki/Plugin/otl.pm b/IkiWiki/Plugin/otl.pm index be339c88e..0cd93a3ec 100644 --- a/IkiWiki/Plugin/otl.pm +++ b/IkiWiki/Plugin/otl.pm @@ -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; diff --git a/IkiWiki/Plugin/rst.pm b/IkiWiki/Plugin/rst.pm index 08ac15e43..789a70ac7 100644 --- a/IkiWiki/Plugin/rst.pm +++ b/IkiWiki/Plugin/rst.pm @@ -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 |