Skip to content

Commit

Permalink
Merge branch '6.2' into 6.3
Browse files Browse the repository at this point in the history
* 6.2:
  [5.4] Allow PhpUnitBridge v7
  [Console] block input stream if needed When the input stream used in the question helper is not blocking, the default value is always used as the stream return false. In order to fix that, we force the stream to be in blocking state and go back to the old state after so other logic is not impacted by this change
  • Loading branch information
nicolas-grekas committed May 25, 2023
2 parents 2211316 + f321cdb commit e047cbd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,18 @@ private function doAsk(OutputInterface $output, Question $question): mixed
}

if (false === $ret) {
$isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;

if (!$isBlocked) {
stream_set_blocking($inputStream, true);
}

$ret = $this->readInput($inputStream, $question);

if (!$isBlocked) {
stream_set_blocking($inputStream, false);
}

if (false === $ret) {
throw new MissingInputException('Aborted.');
}
Expand Down

0 comments on commit e047cbd

Please sign in to comment.