Skip to content

Fix console prompts hanging when isInteractive() is unreliable - #39

Merged
AureDulvresse merged 1 commit into
mainfrom
develop
Oct 7, 2026
Merged

AureDulvresse merged 1 commit into
mainfrom
develop

Conversation

@AureDulvresse

Copy link
Copy Markdown
Collaborator

Command::ask()/confirm()/secret()/choice()/multiChoice() relied solely on $input->isInteractive(), which reflects --no-interaction/-n and Symfony's own best-effort stdin check — observed returning true (i.e. "safe to prompt") on at least one real environment whose stdin would in fact never produce an answer, hanging the command indefinitely. Added canPrompt(), which also requires stream_isatty(STDIN); every prompt now falls back to its default immediately when either check fails, rather than attempting to read one. Found and reproduced while testing marrow/anvil's and marrow/ai-context's own interactive commands — both updated alongside this to use the new guard.

Command::ask()/confirm()/secret()/choice()/multiChoice() relied
solely on $input->isInteractive(), which reflects --no-interaction/-n
and Symfony's own best-effort stdin check — observed returning true
(i.e. "safe to prompt") on at least one real environment whose stdin
would in fact never produce an answer, hanging the command
indefinitely. Added canPrompt(), which also requires
stream_isatty(STDIN); every prompt now falls back to its default
immediately when either check fails, rather than attempting to read
one. Found and reproduced while testing marrow/anvil's and
marrow/ai-context's own interactive commands — both updated alongside
this to use the new guard.
@AureDulvresse
AureDulvresse merged commit a9825e9 into main Oct 7, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant