/**
* 获取输入
* @return null|string
*/
public function getInput()
{
return $this->input;
}// 获取输入信息

/**
* 设置输入
* @param mixed $input
* @return self
*/
public function setInput($input)
{
if ($this->isRunning()) {
throw new \LogicException('Input can not be set while the process is running.');
}

$this->input = Utils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);

return $this;
}// 属于信息 设置

/**
* 获取proc_open的选项
* @return array
*/
public function getOptions()
{
return $this->options;
}// 获取 选项

/**
* 设置proc_open的选项
* @param array $options
* @return self
*/
public function setOptions(array $options)
{
$this->options = $options;

return $this;
}// 设置选项,这个设置,有点唐突哦

/**
* 是否兼容windows
* @return bool
*/
public function getEnhanceWindowsCompatibility()
{
return $this->enhanceWindowsCompatibility;
}// 我就是说这个是 windows 兼容的 情况,一般不兼容这个鬼东西

/**
* 设置是否兼容windows
* @param bool $enhance
* @return self
*/
public function setEnhanceWindowsCompatibility($enhance)
{
$this->enhanceWindowsCompatibility = (bool)$enhance;

return $this;
}// 设置 是否兼容 windows

/**
* 返回是否 sigchild 兼容模式激活
* @return bool
*/
public function getEnhanceSigchildCompatibility()
{
return $this->enhanceSigchildCompatibility;
}// 是否子进程模式 激活

/**
* 激活 sigchild 兼容性模式。
* @param bool $enhance
* @return self
*/
public function setEnhanceSigchildCompatibility($enhance)
{
$this->enhanceSigchildCompatibility = (bool)$enhance;

return $this;
}// 激活它

/**
* 是否超时
*/
public function checkTimeout()
{// 是否超时
if ($this->status !== self::STATUS_STARTED) {
return;
}// 类型

if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
$this->stop();
// 如果 时间 溢出
throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_GENERAL);
}// 抛出异常

if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
$this->stop();

throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_IDLE);
}// 抛出异常2
}

/**
* 是否支持pty
* @return bool
*/
public static function isPtySupported()
{// 是否支持 pty
static $result;// 静态结果

if (null !== $result) {// 有结果,就直接返回
return $result;
}

if ('\\' === DS) {// 在 windows 下呢
return $result = false;// 返回 错误信息
}

$proc = @proc_open('echo 1', [['pty'], ['pty'], ['pty']], $pipes);// 打开类似于管道方式
if (is_resource($proc)) {// 如果是资源
proc_close($proc);// 关闭资源

return $result = true;
}

return $result = false;
}