]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 839095: Fix interdiff failing on mod_perl with "No valid patch files were found...
authorByron Jones <bjones@mozilla.com>
Fri, 15 Feb 2013 05:18:14 +0000 (13:18 +0800)
committerByron Jones <bjones@mozilla.com>
Fri, 15 Feb 2013 05:18:14 +0000 (13:18 +0800)
r=dkl, a=LpSolit

Bugzilla/Attachment/PatchReader.pm

index 29ff1f93f3f418e5dde5e9b92c24073c75ae5290..7bbbfacae7ad6abaffb38a11edd5fef406468d88 100644 (file)
@@ -104,10 +104,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
@@ -145,7 +154,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.