[php-src] Issue #11383: Fwrite to stdout in childprocess not shown
| From: | remco-pc | Date: | Tue, 06 Jun 2023 16:17:20 +0000 |
| Subject: | [php-src] Issue #11383: Fwrite to stdout in childprocess not shown | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244609@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11383
Author: remco-pc
### Description
it won't write text there so you don't know there is a prompt. (fwrite(STDOUT, $text) also
i get a timeout (execute timeout) in my own framework which holds some more code. and if i write
something to stdin it wont get accepted / continue executing script.
test1.php
```
<?php
$command = escapeshellcmd(PHP_BINARY) . ' ' . escapeshellarg(__DIR__ .
'/test2.php');
var_dump(exec($command, $output));
var_dump($output);
```
test2.php
```
<?php
function my_readline($text='') {
fwrite(STDOUT, $text);
return trim(fgets(STDIN));
}
$a = my_readline('test: ');
echo $a;
```
the fwrite to STDOUT isn't executed if i run test1.php
### PHP Version
8.2
### Operating System
Debian 11.6