- // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged
- $numReadyPipes = @stream_select( $readyPipes, $emptyArray, $emptyArray, $timeout );
- // @codingStandardsIgnoreEnd
+ $readPipes = wfArrayFilterByKey( $pipes, function ( $fd ) use ( $desc ) {
+ return $desc[$fd][0] === 'pipe' && $desc[$fd][1] === 'r';
+ } );
+ $writePipes = wfArrayFilterByKey( $pipes, function ( $fd ) use ( $desc ) {
+ return $desc[$fd][0] === 'pipe' && $desc[$fd][1] === 'w';
+ } );
+ // stream_select parameter names are from the POV of us being able to do the operation;
+ // proc_open desriptor types are from the POV of the process doing it.
+ // So $writePipes is passed as the $read parameter and $readPipes as $write.
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
+ $numReadyPipes = @stream_select( $writePipes, $readPipes, $emptyArray, $timeout );