diff options
author | Byron Jones <bjones@mozilla.com> | 2013-02-08 08:05:01 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-02-08 08:05:01 +0100 |
commit | 3161f1f714a6171abd1ba7284887b4e081f1e44c (patch) | |
tree | 7d77a8f0abec98c0c2155543eedc498994fcfa05 | |
parent | ae42f1f17d826b83c62da7b7ec99f474f76f05ec (diff) | |
download | bugzilla-3161f1f714a6171abd1ba7284887b4e081f1e44c.tar.gz bugzilla-3161f1f714a6171abd1ba7284887b4e081f1e44c.tar.xz |
Bug 839095: interdiff fails with "No valid patch files were found in the attachment" on mod_perl
-rw-r--r-- | Bugzilla/Attachment/PatchReader.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Bugzilla/Attachment/PatchReader.pm b/Bugzilla/Attachment/PatchReader.pm index b766a9071..049487b68 100644 --- a/Bugzilla/Attachment/PatchReader.pm +++ b/Bugzilla/Attachment/PatchReader.pm @@ -113,10 +113,19 @@ sub process_interdiff { # Must hack path so that interdiff will work. $ENV{'PATH'} = $lc->{diffpath}; - my ($interdiff_stdout, $interdiff_stderr); - $interdiff_stderr = gensym; - my $pid = open3(gensym, $interdiff_stdout, $interdiff_stderr, - $lc->{interdiffbin}, $old_filename, $new_filename); + my ($pid, $interdiff_stdout, $interdiff_stderr); + if ($ENV{MOD_PERL}) { + require Apache2::RequestUtil; + require Apache2::SubProcess; + my $request = Apache2::RequestUtil->request; + (undef, $interdiff_stdout, $interdiff_stderr) = $request->spawn_proc_prog( + $lc->{interdiffbin}, [$old_filename, $new_filename] + ); + } else { + $interdiff_stderr = gensym; + my $pid = open3(gensym, $interdiff_stdout, $interdiff_stderr, + $lc->{interdiffbin}, $old_filename, $new_filename); + } binmode $interdiff_stdout; # Check for errors @@ -154,7 +163,7 @@ sub process_interdiff { } $reader->iterate_fh($interdiff_stdout, 'interdiff #' . $old_attachment->id . ' #' . $new_attachment->id); - waitpid($pid, 0); + waitpid($pid, 0) if $pid; $ENV{'PATH'} = ''; # Delete temporary files. |