File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,9 @@ public function run()
9999 if ( ( $ genResponse = $ this ->runGen ( $ key , $ readLine ) ) === false )
100100 continue ;
101101
102- $ this ->handleGenResponse ( $ genResponse , $ key );
102+ // If the pipe is dead then invalidate the command...
103+ if ( ! $ this ->handleGenResponse ( $ genResponse , $ key ) )
104+ $ invalidCommands [$ key ] = true ;
103105 }
104106
105107 // If every command is now invalid.
@@ -211,7 +213,16 @@ protected function handleGenResponse($genResponse, $key)
211213 if ( $ this ->commands [$ key ] === end ( $ this ->commands ) )
212214 $ this ->stdOut ->write ( $ genResponse );
213215 else
216+ {
217+ // If we are trying to write to a dead pipe return false...
218+ if ( isset ( $ this ->commandGenerators [$ key + 1 ] )
219+ && ! $ this ->commandGenerators [$ key + 1 ]->valid () )
220+ return false ;
221+
214222 $ this ->buffers [$ key ]->write ( $ genResponse );
223+ }
215224 }
225+
226+ return true ;
216227 }
217228}
You can’t perform that action at this time.
0 commit comments