diff options
author | Byron Jones <bjones@mozilla.com> | 2013-03-25 05:50:05 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-03-25 05:50:05 +0100 |
commit | 9c177145ceb127429b4dc71499ab879caf607fd4 (patch) | |
tree | b12ee791570ea109f053e942195b05154ade5d14 /Bugzilla/Arecibo.pm | |
parent | ddf489ad8abf9e0afa3d4545e784eab7c854bcbe (diff) | |
download | bugzilla-9c177145ceb127429b4dc71499ab879caf607fd4.tar.gz bugzilla-9c177145ceb127429b4dc71499ab879caf607fd4.tar.xz |
Bug 849120: change "send error to error reporter" from forking to running a process
Diffstat (limited to 'Bugzilla/Arecibo.pm')
-rw-r--r-- | Bugzilla/Arecibo.pm | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/Bugzilla/Arecibo.pm b/Bugzilla/Arecibo.pm index 760c60c59..8c3282ab7 100644 --- a/Bugzilla/Arecibo.pm +++ b/Bugzilla/Arecibo.pm @@ -20,9 +20,10 @@ our @EXPORT = qw( use Apache2::Log; use Apache2::SubProcess; use Carp; +use Data::Dumper; use Email::Date::Format qw(email_gmdate); +use File::Temp; use LWP::UserAgent; -use POSIX qw(setsid nice); use Sys::Hostname; use Bugzilla::Constants; @@ -205,27 +206,17 @@ sub arecibo_handle_error { username => $username, ]; - # fork then post - local $SIG{CHLD} = 'IGNORE'; - my $pid = fork(); - if (defined($pid) && $pid == 0) { - # detach - chdir('/'); - open(STDIN, '</dev/null'); - open(STDOUT, '>/dev/null'); - open(STDERR, '>/dev/null'); - setsid(); - nice(19); - - # post to arecibo (ignore any errors) - my $agent = LWP::UserAgent->new( - agent => 'bugzilla.mozilla.org', - timeout => 10, # seconds - ); - $agent->post($arecibo_server, $data); - - CORE::exit(0); + my $fh = File::Temp->new( UNLINK => 0 ); + if (!$fh) { + warn "Failed to create temp file: $!\n"; + return; } + print $fh Dumper($data); + close($fh) or die $!; + my $filename = $fh->filename; + + my $command = bz_locations()->{'cgi_path'} . "/arecibo.pl '$filename' &"; + system($command); return 1; } |