Skip to content

Commit e047cbd

Browse files
Merge branch '6.2' into 6.3
* 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
2 parents 2211316 + f321cdb commit e047cbd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Helper/QuestionHelper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,18 @@ private function doAsk(OutputInterface $output, Question $question): mixed
123123
}
124124

125125
if (false === $ret) {
126+
$isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;
127+
128+
if (!$isBlocked) {
129+
stream_set_blocking($inputStream, true);
130+
}
131+
126132
$ret = $this->readInput($inputStream, $question);
133+
134+
if (!$isBlocked) {
135+
stream_set_blocking($inputStream, false);
136+
}
137+
127138
if (false === $ret) {
128139
throw new MissingInputException('Aborted.');
129140
}

0 commit comments

Comments
 (0)