attempts to fix tests on Travis
This commit is contained in:
parent
2ff187038a
commit
6c11207573
@ -120,6 +120,27 @@ class Process
|
||||
159 => 'Bad syscall',
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns whether PTY is supported on the current operating system.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static function isPtySupported()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$proc = @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
|
||||
if (is_resource($proc)) {
|
||||
proc_close($proc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -1183,7 +1204,7 @@ class Process
|
||||
array('file', '/dev/tty', 'w'),
|
||||
array('file', '/dev/tty', 'w'),
|
||||
);
|
||||
} elseif ($this->pty) {
|
||||
} elseif ($this->pty && self::isPtySupported()) {
|
||||
$descriptors = array(
|
||||
array('pty'),
|
||||
array('pty'),
|
||||
|
@ -205,8 +205,8 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPTYCommand()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$this->markTestSkipped('Windows does not have PTY support.');
|
||||
if ( ! Process::isPtySupported()) {
|
||||
$this->markTestSkipped('PTY is not supported on this operating system.');
|
||||
}
|
||||
|
||||
$process = $this->getProcess('echo "foo"');
|
||||
|
Reference in New Issue
Block a user