[英]Getting Error: TTY mode is not supported on Windows platform
I am trying to improve my testing workflow by running my phpunit tests automatically when I make a change.我试图通过在进行更改时自动运行 phpunit 测试来改进我的测试工作流程。
I have a local dev server on my windows machine and I am trying to run phpunit-watch
.我的 windows 机器上有一个本地开发服务器,我正在尝试运行phpunit-watch
。
TTY mode is not supported on windows platform.
I keep getting this error, is there any work around?我一直收到这个错误,有什么解决方法吗?
The plugin: https://github.com/spatie/phpunit-watcher插件: https://github.com/spatie/phpunit-watcher
没有解决方法,Windows平台不支持TTY模式,这是有原因的。
You could try using WSL ( Windows Subsystem for Linux ).您可以尝试使用 WSL(适用于 Linux 的 Windows 子系统)。 https://docs.microsoft.com/en-us/windows/wsl/install-win10 https://docs.microsoft.com/en-us/windows/wsl/install-win10
If you do this route, note that the file systems between Linux and Windows are different.如果你走这条路线,注意Linux和Windows之间的文件系统是不同的。 The WSL will mount your drives which slows down performance, so if you run your command in /mnt/c/my-folder
, it will run slower than you expect. WSL 将挂载您的驱动器,这会降低性能,因此如果您在/mnt/c/my-folder
运行您的命令,它的运行速度将比您预期的要慢。
The only solutions I know for this so far are: Deal with it, or move your files into the Linux layer.到目前为止,我知道的唯一解决方案是:处理它,或者将您的文件移动到 Linux 层。 If you move your files to the Linux system, you'll get expected speeds.如果您将文件移动到 Linux 系统,您将获得预期的速度。
All php artisan db does is call the MySQL command line, which you can do yourself.所有 php artisan db 所做的都是调用 MySQL 命令行,您可以自己完成。 Check your.env file to get values for the host, username, and password.检查 your.env 文件以获取主机、用户名和密码的值。 Then fill them into this command:然后将它们填充到此命令中:
mysql -h host -u username -ppassword mysql -h 主机 -u 用户名 -ppassword
The artisan test
command (and maybe other commands as well) has an option --without-tty
that allows you to run the command from the Windows command line. artisan test
命令(可能还有其他命令)有一个选项--without-tty
允许您从 Windows 命令行运行该命令。 Like so:像这样:
php artisan test --without-tty
Perhaps, this option has been only present in recent versions of Laravel.也许,这个选项只出现在 Laravel 的最新版本中。
I am not familiar with phpunit-watch yet, but if there is a way to configure the commands used within it, then including this option should solve the issue.我还不熟悉 phpunit-watch,但如果有办法配置其中使用的命令,那么包含此选项应该可以解决问题。
Note: AFAIK, phpunit, itself, runs just fine from the Windows command line.注意:据我所知,phpunit 本身可以从 Windows 命令行正常运行。 Indeed, I use it all the time.确实,我一直都在使用它。 Like so:像这样:
vendor\bin\phpunit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.