[Console] fix "data lost during stream conversion" with QuestionHelper

This commit is contained in:
Nicolas Grekas 2020-05-05 11:01:49 +02:00
parent 2732dda83c
commit 6d089ac437

View File

@ -462,10 +462,6 @@ class QuestionHelper extends Helper
$error = null;
$attempts = $question->getMaxAttempts();
if (null === $attempts && !$this->isTty()) {
$attempts = 1;
}
while (null === $attempts || $attempts--) {
if (null !== $error) {
$this->writeError($output, $error);
@ -477,6 +473,8 @@ class QuestionHelper extends Helper
throw $e;
} catch (\Exception $error) {
}
$attempts = $attempts ?? -(int) $this->isTty();
}
throw $error;
@ -517,7 +515,7 @@ class QuestionHelper extends Helper
return stream_isatty($inputStream);
}
if (!\function_exists('posix_isatty')) {
if (\function_exists('posix_isatty')) {
return posix_isatty($inputStream);
}