简体   繁体   中英

PHP Code Sniffer via Grunt is incredibly slow

I'm having issues with PHP Code Sniffer running inside of a Grunt task.

Everything has been freshly installed. PHP CS runs perfectly from the terminal (run in less than 2 secondes). But when I run it thought a Grunt task (same binaries, config file, params,etc..) it takes over a minute. I tried using grunt-phpcs and grunt-exec (even tried using a subshell $()) always the same result...

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.

Any idea?

You need to adapt the default_socket_timeout in the php.ini for your PHP CLI. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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