laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
533 stars 94 forks source link

Use fallback implementation when `stty` command fails #63

Closed jessarcher closed 1 year ago

jessarcher commented 1 year ago

In scenarios where the fallbackWhen condition is false, but the stty command fails, the prompt will still attempt to render but is unlikely to work correctly.

This has been reported when SSHing into a Linux machine from a Windows terminal, where the environment detection will report a supported environment, but the stty command cannot set the appropriate terminal modes. (Note: This may be due to shared hosting permissions rather than Windows - See https://github.com/laravel/prompts/issues/62#issuecomment-1713052440.)

This PR updates Prompts to enable the fallback when the stty command fails. I have configured it to still output the stty error message in case it can be resolved, but it will only output it once, before the first prompt.

image

I've also improved the error message when no fallback has been registered for users on old Laravel versions or not using Laravel at all. #57 should improve this.

Fixes #62