aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArne Georg Gleditsch <argggh@lxr.linpro.no>2008-02-18 20:51:19 +0100
committerArne Georg Gleditsch <argggh@lxr.linpro.no>2008-02-18 20:51:19 +0100
commit428ac342deed279d18fd6ab9d1c7ac39d0d2f03d (patch)
tree8ca2f79e84e9d87df1a7a7648ac9424940c904df /lib
parent3aa76ee5d430e922b190a89de0844459d0843a9d (diff)
mod_perl is not so happy about plain fork(), use open() instead.
Diffstat (limited to 'lib')
-rw-r--r--lib/LXRng/Web.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/LXRng/Web.pm b/lib/LXRng/Web.pm
index d7f9be4..63ca5b6 100644
--- a/lib/LXRng/Web.pm
+++ b/lib/LXRng/Web.pm
@@ -742,18 +742,20 @@ sub generate_pdf {
'lines' => \@lines},
$texh)
or die $template->error();
- my $pid = fork();
- die $! unless defined($pid);
+
+ my $pdflatex;
+ my $pid = open($pdflatex, "-|");
+ die $! unless defined $pid;
+
if ($pid == 0) {
- close(STDOUT);
- open(STDOUT, "> $texname.output");
close(STDERR);
open(STDERR, ">&STDOUT");
chdir($tempdir);
exec("pdflatex", "$texname");
kill(9, $$);
}
- waitpid($pid, 0);
+ my @err = <$pdflatex>;
+ close($pdflatex);
my $pdfname = $texname;
$pdfname =~ s/[.]tex$/.pdf/;
if (-e $pdfname) {
@@ -769,9 +771,6 @@ sub generate_pdf {
close($pdfh);
}
elsif (-e "$texname.output") {
- open(my $errh, "< $texname.output") or die $!;
- my @err = <$errh>;
- close($errh);
@err = splice(@err, -15) if @err > 15;
die "PDF generation failed: ".join("\n", @err);
}