@@ -293,6 +293,9 @@ public function init()
293293 // be detected properly for files created on a Mac with the /r line ending.
294294 ini_set ('auto_detect_line_endings ' , true );
295295
296+ // Disable the PCRE JIT as this caused issues with parallel running.
297+ ini_set ('pcre.jit ' , false );
298+
296299 // Check that the standards are valid.
297300 foreach ($ this ->config ->standards as $ standard ) {
298301 if (Util \Standards::isInstalledStandard ($ standard ) === false ) {
@@ -536,7 +539,10 @@ private function run()
536539 }//end if
537540 }//end for
538541
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+ }
540546 }//end if
541547
542548 restore_error_handler ();
@@ -709,20 +715,35 @@ private function processChildProcs($childProcs)
709715 $ numProcessed = 0 ;
710716 $ totalBatches = count ($ childProcs );
711717
718+ $ success = true ;
719+
712720 while (count ($ childProcs ) > 0 ) {
713721 foreach ($ childProcs as $ key => $ procData ) {
714722 $ res = pcntl_waitpid ($ procData ['pid ' ], $ status , WNOHANG );
715723 if ($ res === $ procData ['pid ' ]) {
716724 if (file_exists ($ procData ['out ' ]) === true ) {
717725 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 ;
724739 }
725740
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+
726747 if (isset ($ debugOutput ) === true ) {
727748 echo $ debugOutput ;
728749 }
@@ -733,11 +754,6 @@ private function processChildProcs($childProcs)
733754 }
734755 }
735756
736- unlink ($ procData ['out ' ]);
737- unset($ childProcs [$ key ]);
738-
739- $ numProcessed ++;
740-
741757 // Fake a processed file so we can print progress output for the batch.
742758 $ file = new DummyFile (null , $ this ->ruleset , $ this ->config );
743759 $ file ->setErrorCounts (
@@ -752,6 +768,8 @@ private function processChildProcs($childProcs)
752768 }//end foreach
753769 }//end while
754770
771+ return $ success ;
772+
755773 }//end processChildProcs()
756774
757775
0 commit comments