Skip to content

Commit

Permalink
[Console] remove readline support
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Feb 3, 2016
1 parent bad218d commit 0e45a4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

2.8.3
-----

* remove readline support from the question helper as it caused issues

2.8.0
-----

Expand Down
30 changes: 5 additions & 25 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -134,7 +134,11 @@ public function doAsk(OutputInterface $output, Question $question)
}

if (false === $ret) {
$ret = $this->readFromInput($inputStream);
$ret = fgets($inputStream, 4096);
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
$ret = trim($ret);
}
} else {
$ret = trim($this->autocomplete($output, $question, $inputStream));
Expand Down Expand Up @@ -427,30 +431,6 @@ private function getShell()
return self::$shell;
}

/**
* Reads user input.
*
* @param resource $stream The input stream
*
* @return string User input
*
* @throws RuntimeException
*/
private function readFromInput($stream)
{
if (STDIN === $stream && function_exists('readline')) {
$ret = readline('');
} else {
$ret = fgets($stream, 4096);
}

if (false === $ret) {
throw new RuntimeException('Aborted');
}

return trim($ret);
}

/**
* Returns whether Stty is available or not.
*
Expand Down

0 comments on commit 0e45a4a

Please sign in to comment.