Skip to content

Fwrite to stdout in childprocess not shown #11383

Open
@remco-pc

Description

@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

Working in php 7.4

Operating System

Debian 11.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions