内核更新
This commit is contained in:
@@ -25,14 +25,14 @@ class Unix extends Pipes
|
||||
|
||||
public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
|
||||
{
|
||||
$this->ttyMode = (bool)$ttyMode;
|
||||
$this->ptyMode = (bool)$ptyMode;
|
||||
$this->disableOutput = (bool)$disableOutput;
|
||||
$this->ttyMode = (bool) $ttyMode;
|
||||
$this->ptyMode = (bool) $ptyMode;
|
||||
$this->disableOutput = (bool) $disableOutput;
|
||||
|
||||
if (is_resource($input)) {
|
||||
$this->input = $input;
|
||||
} else {
|
||||
$this->inputBuffer = (string)$input;
|
||||
$this->inputBuffer = (string) $input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,12 +134,12 @@ class Unix extends Pipes
|
||||
|
||||
$type = (false !== $found = array_search($pipe, $this->pipes)) ? $found : 'input';
|
||||
$data = '';
|
||||
while ('' !== $dataread = (string)fread($pipe, self::CHUNK_SIZE)) {
|
||||
while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) {
|
||||
$data .= $dataread;
|
||||
}
|
||||
|
||||
if ('' !== $data) {
|
||||
if ($type === 'input') {
|
||||
if ('input' === $type) {
|
||||
$this->inputBuffer .= $data;
|
||||
} else {
|
||||
$read[$type] = $data;
|
||||
@@ -147,7 +147,7 @@ class Unix extends Pipes
|
||||
}
|
||||
|
||||
if (false === $data || (true === $close && feof($pipe) && '' === $data)) {
|
||||
if ($type === 'input') {
|
||||
if ('input' === $type) {
|
||||
$this->input = null;
|
||||
} else {
|
||||
fclose($this->pipes[$type]);
|
||||
@@ -160,7 +160,7 @@ class Unix extends Pipes
|
||||
while (strlen($this->inputBuffer)) {
|
||||
$written = fwrite($w[0], $this->inputBuffer, 2 << 18); // write 512k
|
||||
if ($written > 0) {
|
||||
$this->inputBuffer = (string)substr($this->inputBuffer, $written);
|
||||
$this->inputBuffer = (string) substr($this->inputBuffer, $written);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class Unix extends Pipes
|
||||
*/
|
||||
public function areOpen()
|
||||
{
|
||||
return (bool)$this->pipes;
|
||||
return (bool) $this->pipes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,4 +193,4 @@ class Unix extends Pipes
|
||||
{
|
||||
return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user