Skip to content

Commit 245799d

Browse files
dugwoodjakubpawlowicz
authored andcommitted
Fix bug for PHP-FPM
PHP-FPM has a bug with STDIN: https://bugs.php.net/bug.php?id=73342 Running `clean-css-cli` in a PHP's `exec` will hit the bug, and PHP-FPM master's process will peak at 100% CPU usage. Ignoring the `stdin` test if there's no argument can avoid the bug.
1 parent d860382 commit 245799d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ function cli(process, beforeMinifyCallback) {
132132
}
133133

134134
// If no sensible data passed in just print help and exit
135-
fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY;
136-
if (!fromStdin && commands.args.length === 0) {
137-
commands.outputHelp();
138-
return 0;
135+
if (commands.args.length === 0) {
136+
fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY;
137+
if (!fromStdin) {
138+
commands.outputHelp();
139+
return 0;
140+
}
139141
}
140142

141143
// Now coerce commands into CleanCSS configuration...

0 commit comments

Comments
 (0)