Bug 66111 - fork/exec instead of popen (mod_perl debug)

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@842 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-07-02 13:04:29 +00:00
parent 211503c460
commit d4bb9eece4
1 changed files with 4 additions and 3 deletions

View File

@ -176,7 +176,7 @@ sub DotInto
my $quot = $^O =~ /MSWin/ ? '"' : "'";
my $dottimeout = int(Bugzilla->params->{localdottimeout});
my ($r, $w, $pid);
pipe($r, $w);
pipe($r, $w) || die $!;
$r || return undef;
$SIG{CHLD} = sub { my $kid; do { $kid = waitpid(-1, POSIX::WNOHANG); } while $kid > 0; };
$pid = fork();
@ -190,8 +190,9 @@ sub DotInto
{
alarm($dottimeout);
}
dup2(fileno($w), fileno(\*STDOUT));
exec(@$cmd) || exit;
# use 1 instead of fileno(\*STDOUT) under mod_perl
POSIX::dup2(fileno($w), 1) || die $!;
exec(@$cmd) || die $!;
}
close $w;
local $/ = undef;