Skip to content

Commit 686b649

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: [Console] fix "data lost during stream conversion" with QuestionHelper
2 parents 1f37737 + 19345bf commit 686b649

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Helper/QuestionHelper.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,6 @@ private function validateAttempts(callable $interviewer, OutputInterface $output
460460
$error = null;
461461
$attempts = $question->getMaxAttempts();
462462

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

480478
throw $error;
@@ -515,7 +513,7 @@ private function isTty(): bool
515513
return stream_isatty($inputStream);
516514
}
517515

518-
if (!\function_exists('posix_isatty')) {
516+
if (\function_exists('posix_isatty')) {
519517
return posix_isatty($inputStream);
520518
}
521519

0 commit comments

Comments
 (0)