Symfony\Component\Process\Process::isPtySupported PHP Method

isPtySupported() public static method

Returns whether PTY is supported on the current operating system.
public static isPtySupported ( ) : boolean
return boolean
    public static function isPtySupported()
    {
        static $result;
        if (null !== $result) {
            return $result;
        }
        if ('\\' === DIRECTORY_SEPARATOR) {
            return $result = false;
        }
        return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
    }

Usage Example

Example #1
0
 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'));
 }
All Usage Examples Of Symfony\Component\Process\Process::isPtySupported