Happens that i need to track file status through ssh by php(using phpunit). But when i trying to launch this code:
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
$cmd = "ssh hostname 'tail -F ~/test.file'";
$proc = proc_open($cmd, $descriptorspec, $pipes, null);
$str = fgets($pipes[1]);
echo $str;
if (!fclose($pipes[0])) {
throw new Exception("Can't close pipe 0");
}
if (!fclose($pipes[1])) {
throw new Exception("pipe 1");
}
if (!fclose($pipes[2])) {
throw new Exception("pipe 2");
}
$res = proc_close($proc);
nothing happens - no output, and i guess deadlock exucuted: script doesn't exit. Have any ideas? or suggestions?