@@ -293,6 +293,9 @@ public function init()
293
293
// be detected properly for files created on a Mac with the /r line ending.
294
294
ini_set ('auto_detect_line_endings ' , true );
295
295
296
+ // Disable the PCRE JIT as this caused issues with parallel running.
297
+ ini_set ('pcre.jit ' , false );
298
+
296
299
// Check that the standards are valid.
297
300
foreach ($ this ->config ->standards as $ standard ) {
298
301
if (Util \Standards::isInstalledStandard ($ standard ) === false ) {
@@ -536,7 +539,10 @@ private function run()
536
539
}//end if
537
540
}//end for
538
541
539
- $ this ->processChildProcs ($ childProcs );
542
+ $ success = $ this ->processChildProcs ($ childProcs );
543
+ if ($ success === false ) {
544
+ throw new RuntimeException ('One or more child processes failed to run ' );
545
+ }
540
546
}//end if
541
547
542
548
restore_error_handler ();
@@ -709,20 +715,35 @@ private function processChildProcs($childProcs)
709
715
$ numProcessed = 0 ;
710
716
$ totalBatches = count ($ childProcs );
711
717
718
+ $ success = true ;
719
+
712
720
while (count ($ childProcs ) > 0 ) {
713
721
foreach ($ childProcs as $ key => $ procData ) {
714
722
$ res = pcntl_waitpid ($ procData ['pid ' ], $ status , WNOHANG );
715
723
if ($ res === $ procData ['pid ' ]) {
716
724
if (file_exists ($ procData ['out ' ]) === true ) {
717
725
include $ procData ['out ' ];
718
- if (isset ($ childOutput ) === true ) {
719
- $ this ->reporter ->totalFiles += $ childOutput ['totalFiles ' ];
720
- $ this ->reporter ->totalErrors += $ childOutput ['totalErrors ' ];
721
- $ this ->reporter ->totalWarnings += $ childOutput ['totalWarnings ' ];
722
- $ this ->reporter ->totalFixable += $ childOutput ['totalFixable ' ];
723
- $ this ->reporter ->totalFixed += $ childOutput ['totalFixed ' ];
726
+
727
+ unlink ($ procData ['out ' ]);
728
+ unset($ childProcs [$ key ]);
729
+
730
+ $ numProcessed ++;
731
+
732
+ if (isset ($ childOutput ) === false ) {
733
+ // The child process died, so the run has failed.
734
+ $ file = new DummyFile (null , $ this ->ruleset , $ this ->config );
735
+ $ file ->setErrorCounts (1 , 0 , 0 , 0 );
736
+ $ this ->printProgress ($ file , $ totalBatches , $ numProcessed );
737
+ $ success = false ;
738
+ continue ;
724
739
}
725
740
741
+ $ this ->reporter ->totalFiles += $ childOutput ['totalFiles ' ];
742
+ $ this ->reporter ->totalErrors += $ childOutput ['totalErrors ' ];
743
+ $ this ->reporter ->totalWarnings += $ childOutput ['totalWarnings ' ];
744
+ $ this ->reporter ->totalFixable += $ childOutput ['totalFixable ' ];
745
+ $ this ->reporter ->totalFixed += $ childOutput ['totalFixed ' ];
746
+
726
747
if (isset ($ debugOutput ) === true ) {
727
748
echo $ debugOutput ;
728
749
}
@@ -733,11 +754,6 @@ private function processChildProcs($childProcs)
733
754
}
734
755
}
735
756
736
- unlink ($ procData ['out ' ]);
737
- unset($ childProcs [$ key ]);
738
-
739
- $ numProcessed ++;
740
-
741
757
// Fake a processed file so we can print progress output for the batch.
742
758
$ file = new DummyFile (null , $ this ->ruleset , $ this ->config );
743
759
$ file ->setErrorCounts (
@@ -752,6 +768,8 @@ private function processChildProcs($childProcs)
752
768
}//end foreach
753
769
}//end while
754
770
771
+ return $ success ;
772
+
755
773
}//end processChildProcs()
756
774
757
775
0 commit comments