简体   繁体   English

通过 Grunt 的 PHP 代码嗅探器非常慢

[英]PHP Code Sniffer via Grunt is incredibly slow

I'm having issues with PHP Code Sniffer running inside of a Grunt task.我在 Grunt 任务中运行 PHP 代码嗅探器时遇到问题。

Everything has been freshly installed.一切都是全新安装的。 PHP CS runs perfectly from the terminal (run in less than 2 secondes). PHP CS 从终端完美运行(运行时间不到 2 秒)。 But when I run it thought a Grunt task (same binaries, config file, params,etc..) it takes over a minute.但是当我运行它认为 Grunt 任务(相同的二进制文件、配置文件、参数等)时,它需要一分钟多的时间。 I tried using grunt-phpcs and grunt-exec (even tried using a subshell $()) always the same result...我尝试使用grunt-phpcsgrunt-exec (甚至尝试使用子shell $())总是相同的结果......

Execution Time (2016-05-26 00:09:21 UTC)
loading tasks    956ms  ▇▇ 2%
exec:phpcs     1m 0.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 98%
Total 1m 2s

I'm on El Capitan, using node 5.11, grunt 1.0.1.我在 El Capitan,使用节点 5.11,grunt 1.0.1。

Any idea?任何的想法?

You need to adapt the default_socket_timeout in the php.ini for your PHP CLI.您需要为 PHP CLI 调整php.inidefault_socket_timeout This has worked for me:这对我有用:

default_socket_timeout = 0

See also http://php.net/default-socket-timeout and https://github.com/nodejs/node-v0.x-archive/issues/3627 .另请参阅http://php.net/default-socket-timeouthttps://github.com/nodejs/node-v0.x-archive/issues/3627

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM