Detect EOF when reading input stream

[Console] Change back to fgets() in DialogHelper
This commit is contained in:
lenar 2011-07-15 13:21:44 +03:00
parent 8700cd6154
commit 07298ac699

View File

@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class DialogHelper extends Helper
{
private $inputStream;
private $inputStream = STDIN;
/**
* Asks a question to the user.
@ -35,7 +35,8 @@ class DialogHelper extends Helper
{
$output->write($question);
if (false === $ret = stream_get_line(null === $this->inputStream ? STDIN : $this->inputStream, 4096, "\n")) {
$ret = fgets($this->inputStream, 4096);
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
$ret = trim($ret);