Closed maPer77 closed 1 year ago
Hi @maPer77,
Just to be clear, are you SSHing into a Linux machine before running php artisan migrate
?
Prompts don't currently work on Windows due to platform limitations, so we configure Prompts in Laravel to fall back to Symfony prompts. If you are SSH'd into a Linux machine, the current platform detection will detect Linux and not fall back. The platform limitations relate to how we can control the terminal's behaviour using the stty
command. From your screenshot, it looks like the stty
exists in your environment, but it has failed, which will prevent Prompts from being able to intercept your key presses. This may be due to using a Windows terminal, but I'm not sure.
I will try to replicate the above scenario and see whether I can either fix it, or update the fallback behaviour.
In the meantime, you can configure additional scenarios when Prompts fall back using the fallbackWhen
method in the boot
method of your AppServiceProvider.php
file. In your case, you may want to configure Prompts to always fall back when your application is in production:
\Laravel\Prompts\Prompt::fallbackWhen(app()->isProduction());
Or you can always fall back:
\Laravel\Prompts\Prompt::fallbackWhen(true);
Hi @jessarcher, Thanks for the answer. Yes, I'm connecting SSH to a Linux machine.
May be stty mode set at that time ssh permission required.
sudo stty -icanon -isig -echo
Then
stty -g
@jessarcher ?
Hi @utsavsomaiya
I believe what is happening is that I am connected to shared hosting, I do not have permission for some things, it seems that one of those things is 'stty'.
This resolved it very well:
\Laravel\Prompts\Prompt::fallbackWhen(true);
Thank you all.
The ideal would be for 'Prompt' to identify that 'stty' cannot be loaded and switch to fallback automatically. I don't know if this would be possible, it would prevent other people from having this same problem.
Can you please run in your ssh above given command using sudo?
Somehow this is implemented, maybe it needs some more checks.
Can you please run in your ssh above given command using sudo?
I have a branch that will automatically trigger the fallback when the stty
command fails. Will push it up soon.
Laravel Prompts Version
latest
Laravel Version
10.22.0
PHP Version
8.2.10
Operating System & Version
Windows 10
Terminal Application
PowerShell with SSH command
Description
The right and left keys do not work to select the option. "^[[D" appears for the left key and "^[[C" for the right key, it is not possible to select the desired option.
Steps To Reproduce