Fwrite to stdout in childprocess not shown
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
Working in php 7.4
Operating System
Debian 11.6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the issue's test1.php and test2.php scripts under PHP 8.2 on Debian 11.6, comparing the child process's stdout prompt and stdin handling with PHP 7.4. Then trace the exec and child-process I/O behavior to identify why fwrite(STDOUT, $text) is not visible or why input does not continue; done means the prompt is shown and input is accepted without a timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100