[Process] Fix #9861 : Revert TTY mode
This commit is contained in:
parent
b2d594daa0
commit
160b1cfae8
@ -246,6 +246,13 @@ class Process
|
||||
$this->status = self::STATUS_STARTED;
|
||||
|
||||
$this->processPipes->unblock();
|
||||
|
||||
if ($this->tty) {
|
||||
$this->status = self::STATUS_TERMINATED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->processPipes->write(false, $this->stdin);
|
||||
$this->updateStatus(false);
|
||||
$this->checkTimeout();
|
||||
@ -740,7 +747,7 @@ class Process
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the TTY mode is enabled.
|
||||
* Checks if the TTY mode is enabled.
|
||||
*
|
||||
* @return Boolean true if the TTY mode is enabled, false otherwise
|
||||
*/
|
||||
@ -941,7 +948,7 @@ class Process
|
||||
*/
|
||||
private function getDescriptors()
|
||||
{
|
||||
$this->processPipes = new ProcessPipes($this->useFileHandles);
|
||||
$this->processPipes = new ProcessPipes($this->useFileHandles, $this->tty);
|
||||
$descriptors = $this->processPipes->getDescriptors();
|
||||
|
||||
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
|
@ -26,10 +26,13 @@ class ProcessPipes
|
||||
private $readBytes = array();
|
||||
/** @var Boolean */
|
||||
private $useFiles;
|
||||
/** @var Boolean */
|
||||
private $ttyMode;
|
||||
|
||||
public function __construct($useFiles = false)
|
||||
public function __construct($useFiles, $ttyMode)
|
||||
{
|
||||
$this->useFiles = (Boolean) $useFiles;
|
||||
$this->ttyMode = (Boolean) $ttyMode;
|
||||
|
||||
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
|
||||
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
|
||||
@ -108,6 +111,14 @@ class ProcessPipes
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->ttyMode) {
|
||||
return array(
|
||||
array('file', '/dev/tty', 'r'),
|
||||
array('file', '/dev/tty', 'w'),
|
||||
array('file', '/dev/tty', 'w'),
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
array('pipe', 'r'), // stdin
|
||||
array('pipe', 'w'), // stdout
|
||||
|
Reference in New Issue
Block a user