[Process] Fix #9861 : Revert TTY mode

This commit is contained in:
Romain Neutron 2014-01-07 10:02:59 +01:00
parent b2d594daa0
commit 160b1cfae8
2 changed files with 21 additions and 3 deletions

View File

@ -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()) {

View File

@ -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