@@ -717,52 +717,55 @@ private function processChildProcs($childProcs)
717717
718718 while (count ($ childProcs ) > 0 ) {
719719 $ pid = pcntl_waitpid (0 , $ status );
720- if ($ pid > 0 ) {
721- $ out = $ childProcs [$ pid ];
722- unset($ childProcs [$ pid ]);
723- if (file_exists ($ out ) === true ) {
724- include $ out ;
725-
726- unlink ($ out );
727-
728- $ numProcessed ++;
729-
730- if (isset ($ childOutput ) === false ) {
731- // The child process died, so the run has failed.
732- $ file = new DummyFile ('' , $ this ->ruleset , $ this ->config );
733- $ file ->setErrorCounts (1 , 0 , 0 , 0 );
734- $ this ->printProgress ($ file , $ totalBatches , $ numProcessed );
735- $ success = false ;
736- continue ;
737- }
720+ if ($ pid <= 0 ) {
721+ continue ;
722+ }
738723
739- $ this -> reporter -> totalFiles + = $ childOutput [ ' totalFiles ' ];
740- $ this -> reporter -> totalErrors += $ childOutput [ ' totalErrors ' ] ;
741- $ this -> reporter -> totalWarnings += $ childOutput [ ' totalWarnings ' ];
742- $ this -> reporter -> totalFixable += $ childOutput [ ' totalFixable ' ] ;
743- $ this -> reporter -> totalFixed += $ childOutput [ ' totalFixed ' ];
724+ $ out = $ childProcs [ $ pid ];
725+ unset( $ childProcs [ $ pid ]) ;
726+ if ( file_exists ( $ out ) === false ) {
727+ continue ;
728+ }
744729
745- if (isset ($ debugOutput ) === true ) {
746- echo $ debugOutput ;
747- }
730+ include $ out ;
731+ unlink ($ out );
748732
749- if (isset ($ childCache ) === true ) {
750- foreach ($ childCache as $ path => $ cache ) {
751- Cache::set ($ path , $ cache );
752- }
753- }
733+ $ numProcessed ++;
754734
755- // Fake a processed file so we can print progress output for the batch.
756- $ file = new DummyFile ('' , $ this ->ruleset , $ this ->config );
757- $ file ->setErrorCounts (
758- $ childOutput ['totalErrors ' ],
759- $ childOutput ['totalWarnings ' ],
760- $ childOutput ['totalFixable ' ],
761- $ childOutput ['totalFixed ' ]
762- );
763- $ this ->printProgress ($ file , $ totalBatches , $ numProcessed );
764- }//end if
765- }//end if
735+ if (isset ($ childOutput ) === false ) {
736+ // The child process died, so the run has failed.
737+ $ file = new DummyFile ('' , $ this ->ruleset , $ this ->config );
738+ $ file ->setErrorCounts (1 , 0 , 0 , 0 );
739+ $ this ->printProgress ($ file , $ totalBatches , $ numProcessed );
740+ $ success = false ;
741+ continue ;
742+ }
743+
744+ $ this ->reporter ->totalFiles += $ childOutput ['totalFiles ' ];
745+ $ this ->reporter ->totalErrors += $ childOutput ['totalErrors ' ];
746+ $ this ->reporter ->totalWarnings += $ childOutput ['totalWarnings ' ];
747+ $ this ->reporter ->totalFixable += $ childOutput ['totalFixable ' ];
748+ $ this ->reporter ->totalFixed += $ childOutput ['totalFixed ' ];
749+
750+ if (isset ($ debugOutput ) === true ) {
751+ echo $ debugOutput ;
752+ }
753+
754+ if (isset ($ childCache ) === true ) {
755+ foreach ($ childCache as $ path => $ cache ) {
756+ Cache::set ($ path , $ cache );
757+ }
758+ }
759+
760+ // Fake a processed file so we can print progress output for the batch.
761+ $ file = new DummyFile ('' , $ this ->ruleset , $ this ->config );
762+ $ file ->setErrorCounts (
763+ $ childOutput ['totalErrors ' ],
764+ $ childOutput ['totalWarnings ' ],
765+ $ childOutput ['totalFixable ' ],
766+ $ childOutput ['totalFixed ' ]
767+ );
768+ $ this ->printProgress ($ file , $ totalBatches , $ numProcessed );
766769 }//end while
767770
768771 return $ success ;
0 commit comments