Skip to content

Commit 47aef3f

Browse files
committed
Merge branch '5.0'
* 5.0: [Console] fix "data lost during stream conversion" with QuestionHelper
2 parents 0cbce5b + 686b649 commit 47aef3f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: Helper/QuestionHelper.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,6 @@ private function validateAttempts(callable $interviewer, OutputInterface $output
461461
$error = null;
462462
$attempts = $question->getMaxAttempts();
463463

464-
if (null === $attempts && !$this->isTty()) {
465-
$attempts = 1;
466-
}
467-
468464
while (null === $attempts || $attempts--) {
469465
if (null !== $error) {
470466
$this->writeError($output, $error);
@@ -476,6 +472,8 @@ private function validateAttempts(callable $interviewer, OutputInterface $output
476472
throw $e;
477473
} catch (\Exception $error) {
478474
}
475+
476+
$attempts = $attempts ?? -(int) $this->isTty();
479477
}
480478

481479
throw $error;
@@ -516,7 +514,7 @@ private function isTty(): bool
516514
return stream_isatty($inputStream);
517515
}
518516

519-
if (!\function_exists('posix_isatty')) {
517+
if (\function_exists('posix_isatty')) {
520518
return posix_isatty($inputStream);
521519
}
522520

0 commit comments

Comments
 (0)