stechstudio / laravel-env-security

Securely manage Laravel .env files for different deployment environments
MIT License
75 stars 9 forks source link

TTY mode is not supported on Windows platform #17

Closed ForTraining-Projects closed 3 years ago

ForTraining-Projects commented 3 years ago

When starting php artisan env:edit on a Windows system I get a RuntimeException caused by

$process->setTty(true);

in STS\EnvSecurity\Console\Edit.php, line 82.

The message says "TTY mode is not supported on Windows platform"

When I simply disable that line everything works smooth. I don't know what setTty() is doing but it doesn't work on Windows systems. Please disable it or catch the exception so we can use that package. Thank you.

bubba-h57 commented 3 years ago

@ForTraining-Projects check out the No TTY For Windows and let us know if that solves the issue for you.

We also updated the documentation, which now has links to what TTY Mode is (explaining why we use it by default) as well as why it doesn't work on Windows Platforms.

jszobody commented 3 years ago

@ForTraining-Projects specifically, you need to install this package with the branch in progress like this:

composer require stechstudio/laravel-env-security:dev-No_TTY_For_Windows

Please try that and let us know if it resolves the issue, and allows you to use the package.

ForTraining-Projects commented 3 years ago

@jszobody, @bubba-h57

Thank you for your changes. It works now. 👍

ShaneEBryan commented 3 years ago

I've been using the code in #19 to handle this issue. I used the following code to determine if the file has changed before proceeding to encrypt the file.

if (!Process::isTtySupported()) { while (empty(file_get_contents($meta['uri'])) || file_get_contents($meta['uri']) === $contents) { sleep(10); } }

jszobody commented 3 years ago

@ForTraining-Projects I just updated the main release of this package now to better handle the lack of TTY on Windows. You should be able to remove the dev-No_TTY_For_Windows version constraint from your composer.json, and instead replace it with ^1.10 and do a composer update.