@@ -304,7 +304,7 @@ public function start(callable $callback = null, array $env = [])
304304 $ this ->resetProcessData ();
305305 $ this ->starttime = $ this ->lastOutputTime = microtime (true );
306306 $ this ->callback = $ this ->buildCallback ($ callback );
307- $ descriptors = $ this ->getDescriptors ();
307+ $ descriptors = $ this ->getDescriptors (null !== $ callback );
308308
309309 if ($ this ->env ) {
310310 $ env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey ($ this ->env , $ env , 'strcasecmp ' ) : $ this ->env ;
@@ -1240,15 +1240,15 @@ public static function isPtySupported(): bool
12401240 /**
12411241 * Creates the descriptors needed by the proc_open.
12421242 */
1243- private function getDescriptors (): array
1243+ private function getDescriptors (bool $ hasCallback ): array
12441244 {
12451245 if ($ this ->input instanceof \Iterator) {
12461246 $ this ->input ->rewind ();
12471247 }
12481248 if ('\\' === \DIRECTORY_SEPARATOR ) {
1249- $ this ->processPipes = new WindowsPipes ($ this ->input , !$ this ->outputDisabled || $ this -> callback );
1249+ $ this ->processPipes = new WindowsPipes ($ this ->input , !$ this ->outputDisabled || $ hasCallback );
12501250 } else {
1251- $ this ->processPipes = new UnixPipes ($ this ->isTty (), $ this ->isPty (), $ this ->input , !$ this ->outputDisabled || $ this -> callback );
1251+ $ this ->processPipes = new UnixPipes ($ this ->isTty (), $ this ->isPty (), $ this ->input , !$ this ->outputDisabled || $ hasCallback );
12521252 }
12531253
12541254 return $ this ->processPipes ->getDescriptors ();
0 commit comments