8000 [Process] Fix #9861 : Revert TTY mode · romainneutron/symfony@160b1cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 160b1cf

Browse files
committed
[Process] Fix symfony#9861 : Revert TTY mode
1 parent b2d594d commit 160b1cf

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ public function start($callback = null)
246246
$this->status = self::STATUS_STARTED;
247247

248248
$this->processPipes->unblock();
249+
250+
if ($this->tty) {
251+
$this->status = self::STATUS_TERMINATED;
252+
253+
return;
254+
}
255+
249256
$this->processPipes->write(false, $this->stdin);
250257
$this->updateStatus(false);
251258
$this->checkTimeout();
@@ -740,7 +747,7 @@ public function setTty($tty)
740747
}
741748

742749
/**
743-
* Checks if the TTY mode is enabled.
750+
* Checks if the TTY mode is enabled.
744751
*
745752
* @return Boolean true if the TTY mode is enabled, false otherwise
746753
*/
@@ -941,7 +948,7 @@ public function checkTimeout()
941948
*/
942949
private function getDescriptors()
943950
{
944-
$this->processPipes = new ProcessPipes($this->useFileHandles);
951+
$this->processPipes = new ProcessPipes($this->useFileHandles, $this->tty);
945952
$descriptors = $this->processPipes->getDescriptors();
946953

947954
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {

src/Symfony/Component/Process/ProcessPipes.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ class ProcessPipes
2626
private $readBytes = array();
2727
/** @var Boolean */
2828
private $useFiles;
29+
/** @var Boolean */
30+
private $ttyMode;
2931

30-
public function __construct($useFiles = false)
32+
public function __construct($useFiles, $ttyMode)
3133
{
3234
$this->useFiles = (Boolean) $useFiles;
35+
$this->ttyMode = (Boolean) $ttyMode;
3336

3437
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
3538
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
@@ -108,6 +111,14 @@ public function getDescriptors()
108111
);
109112
}
110113

114+
if ($this->ttyMode) {
115+
return array(
116+
array('file', '/dev/tty', 'r'),
117+
array('file', '/dev/tty', 'w'),
118+
array('file', '/dev/tty', 'w'),
119+
);
120+
}
121+
111122
return array(
112123
array('pipe', 'r'), // stdin
113124
array('pipe', 'w'), // stdout

0 commit comments

Comments
 (0)
0