From 83e652c3455dfc241fec8d9b924f216e530d7bd1 Mon Sep 17 00:00:00 2001 From: Yvan Date: Sun, 27 May 2018 09:23:31 +0200 Subject: [PATCH] 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. --- index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index ef646c9..3d37d7e 100644 --- a/index.js +++ b/index.js @@ -131,10 +131,12 @@ function cli(process, beforeMinifyCallback) { } // If no sensible data passed in just print help and exit - fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY; - if (!fromStdin && commands.args.length === 0) { - commands.outputHelp(); - return 0; + if (commands.args.length === 0) { + fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY; + if (!fromStdin) { + commands.outputHelp(); + return 0; + } } // Now coerce commands into CleanCSS configuration...