[Console] fix "data lost during stream conversion" with QuestionHelper
This commit is contained in:
parent
2732dda83c
commit
6d089ac437
@ -462,10 +462,6 @@ class QuestionHelper extends Helper
|
|||||||
$error = null;
|
$error = null;
|
||||||
$attempts = $question->getMaxAttempts();
|
$attempts = $question->getMaxAttempts();
|
||||||
|
|
||||||
if (null === $attempts && !$this->isTty()) {
|
|
||||||
$attempts = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (null === $attempts || $attempts--) {
|
while (null === $attempts || $attempts--) {
|
||||||
if (null !== $error) {
|
if (null !== $error) {
|
||||||
$this->writeError($output, $error);
|
$this->writeError($output, $error);
|
||||||
@ -477,6 +473,8 @@ class QuestionHelper extends Helper
|
|||||||
throw $e;
|
throw $e;
|
||||||
} catch (\Exception $error) {
|
} catch (\Exception $error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$attempts = $attempts ?? -(int) $this->isTty();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $error;
|
throw $error;
|
||||||
@ -517,7 +515,7 @@ class QuestionHelper extends Helper
|
|||||||
return stream_isatty($inputStream);
|
return stream_isatty($inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\function_exists('posix_isatty')) {
|
if (\function_exists('posix_isatty')) {
|
||||||
return posix_isatty($inputStream);
|
return posix_isatty($inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user