In PHP I am using proc_open to run a command at the command line.
It needs to open in a new CMD window, so I prepended 'start' to the beginning of the command.
However, it also needs to stay open to display the results, but actually it closes the window automatically afterwards.
I have tried adding 'pause' and also the /k option to 'remain'. But neither work. The window just shuts.
How can I make the window stay open when using proc_open?
This is part of the code, $cmd is filled earlier:
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout
2 => array('pipe', 'w'), // stderr
);
$process = proc_open($cmd, $descriptorspec, $pipes);
if (!is_resource($process))
{
throw new RuntimeException('Unable to execute the command.');
}
stream_set_blocking($pipes[1], false);
stream_set_blocking($pipes[2], false);