本文整理汇总了PHP中Symfony\Component\Process\Process::isPtySupported方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::isPtySupported方法的具体用法?PHP Process::isPtySupported怎么用?PHP Process::isPtySupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\Process
的用法示例。
在下文中一共展示了Process::isPtySupported方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDescriptors
public function getDescriptors()
{
if ($this->disableOutput) {
$nullstream = fopen('/dev/null', 'c');
return array(array('pipe', 'r'), $nullstream, $nullstream);
}
if ($this->ttyMode) {
return array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w'));
}
if ($this->ptyMode && Process::isPtySupported()) {
return array(array('pty'), array('pty'), array('pty'));
}
return array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
}
示例2: getDescriptors
/**
* Returns an array of descriptors for the use of proc_open.
*
* @return array
*/
public function getDescriptors()
{
if ($this->disableOutput) {
$nullstream = fopen(defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null', 'c');
return array(array('pipe', 'r'), $nullstream, $nullstream);
}
if ($this->useFiles) {
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800)
// We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650
// So we redirect output within the commandline and pass the nul device to the process
return array(array('pipe', 'r'), array('file', 'NUL', 'w'), array('file', 'NUL', 'w'));
}
if ($this->ttyMode) {
return array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w'));
} elseif ($this->ptyMode && Process::isPtySupported()) {
return array(array('pty'), array('pty'), array('pty'));
}
return array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
}
示例3: testPTYCommand
public function testPTYCommand()
{
if (!Process::isPtySupported()) {
$this->markTestSkipped('PTY is not supported on this operating system.');
}
$process = $this->getProcess('echo "foo"');
$process->setPty(true);
$process->run();
$this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
$this->assertEquals("foo\r\n", $process->getOutput());
}
示例4: getDescriptors
/**
* Returns an array of descriptors for the use of proc_open.
*
* @return array
*/
public function getDescriptors()
{
if ($this->useFiles) {
return array(array('pipe', 'r'), $this->fileHandles[Process::STDOUT], array('pipe', 'w'));
}
if ($this->ttyMode) {
return array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w'));
} elseif ($this->ptyMode && Process::isPtySupported()) {
return array(array('pty'), array('pty'), array('pty'));
}
return array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
}