Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running console commands with required input with a non-TTY stdin causes an infinite loop #6132

Closed
mattgrayisok opened this issue May 24, 2020 · 1 comment

Comments

@mattgrayisok
Copy link

mattgrayisok commented May 24, 2020

Description

Running any console commands which have a required or validated input that isn't included as a command line argument causes a prompt to appear asking the user for input. When this happens with a non-TTY stdin the prompt is immediately returned as empty which triggers a validation error and re-prompt resulting in an infinite loop.

This has caught me out in 2 places:

  • Running commands from CI
  • Running commands in docker without attaching a TTY

EDIT:

I stopped being lazy and tracked down the bug. It's actually in Yii here:

https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseConsole.php#L800

(Nice to see an oldschool goto in there)

So maybe a Yii2 PR would be better than overriding the prompt() method...

Steps to reproduce

  1. echo "loop" | ./craft install

Additional info

  • Craft version: 3.4
  • PHP version: 7.3
@mattgrayisok mattgrayisok changed the title Running console commands with required input from in a non-TTY environment causes an infinite loop Running console commands with required input with a non-TTY stdin causes an infinite loop May 24, 2020
@brandonkelly
Copy link
Member

Yeah, this would need to be addressed in Yii.

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

No branches or pull requests

2 participants