[Console] replaced fgets by stream_get_line in DialogHelper
Problem with fgets is that false means two things: an error or the end of the stream. That's ok for STDIN, but it becomes a problem when using another stream (in a unit test for instance).
This commit is contained in:
parent
7eec2ca7b3
commit
3a5d508766
@ -35,7 +35,7 @@ class DialogHelper extends Helper
|
|||||||
{
|
{
|
||||||
$output->write($question);
|
$output->write($question);
|
||||||
|
|
||||||
if (false === $ret = fgets(null === $this->inputStream ? STDIN : $this->inputStream)) {
|
if (false === stream_get_line(null === $this->inputStream ? STDIN : $this->inputStream, 4096, "\n")) {
|
||||||
throw new \Exception('Aborted');
|
throw new \Exception('Aborted');
|
||||||
}
|
}
|
||||||
$ret = trim($ret);
|
$ret = trim($ret);
|
||||||
|
Reference in New Issue
Block a user