Skip to content

Commit 07298ac

Browse files
committed
Detect EOF when reading input stream
[Console] Change back to fgets() in DialogHelper
1 parent 8700cd6 commit 07298ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/Console/Helper/DialogHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class DialogHelper extends Helper
2222
{
23-
private $inputStream;
23+
private $inputStream = STDIN;
2424

2525
/**
2626
* Asks a question to the user.
@@ -35,7 +35,8 @@ public function ask(OutputInterface $output, $question, $default = null)
3535
{
3636
$output->write($question);
3737

38-
if (false === $ret = stream_get_line(null === $this->inputStream ? STDIN : $this->inputStream, 4096, "\n")) {
38+
$ret = fgets($this->inputStream, 4096);
39+
if (false === $ret) {
3940
throw new \RuntimeException('Aborted');
4041
}
4142
$ret = trim($ret);

0 commit comments

Comments
 (0)