I am trying to get an interactive program to run in PHP, now this works fine in TTY, only I can only have some control of the STDIN / STDOUT through PTY.
Only when I try this it has some weird side effects, like the code below when i type something in vim I cannot use the ESC key anymore it prints.
^[
There are also some weird characters when it starts these:
^[[2;2R^[[2;2R^[[>1;4002;0c^[[>1;4002;0c
$cmd = 'vim';
$proc = new \Symfony\Component\Process\Process($cmd);
$proc->setPty(true);
$proc->start();
$proc->wait(function($type, $buffer) use ($proc) {
if (\Symfony\Component\Process\Process::ERR) {
fwrite(STDERR, $buffer);
}
if (\Symfony\Component\Process\Process::OUT) {
fwrite(STDOUT, $buffer);
}
});
So how can I get this working, that the ESC key behaves normal and have some control of the stdin / stdout?