From 27b5f4b2d0ddc37699810bb14f4b0932ed6faab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 20 Nov 2015 14:04:14 +0200 Subject: [PATCH] handle more ng exit codes comments from #87: * cbed5408dddccae5589bcef73c5aeedeed06b8e5 For some reasons Nailgun thinks that it's server broke the connection and returns 227 instead of 0 We'll just handle this here instead of fixing the nailgun client itself. * 7810d4a44563f7a5dddff7fca2e11e7191979bbe It also sometimes breaks on 229 on the devbox. To complete this whole madness and made future 'fixes' easier I added this nice little array... --- lib/Minify/NailgunClosureCompiler.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/Minify/NailgunClosureCompiler.php b/lib/Minify/NailgunClosureCompiler.php index 6634bd4..a3fe291 100644 --- a/lib/Minify/NailgunClosureCompiler.php +++ b/lib/Minify/NailgunClosureCompiler.php @@ -17,9 +17,18 @@ class Minify_NailgunClosureCompiler extends Minify_ClosureCompiler const NG_SERVER = 'com.martiansoftware.nailgun.NGServer'; const CC_MAIN = 'com.google.javascript.jscomp.CommandLineRunner'; - // exit code that ng gives - // FIXME: figure out the meaning of the value - const NG_EXIT_CODE = 227; + /** + * For some reasons Nailgun thinks that it's server + * broke the connection and returns 227 instead of 0 + * We'll just handle this here instead of fixing + * the nailgun client itself. + * + * It also sometimes breaks on 229 on the devbox. + * To complete this whole madness and made future + * 'fixes' easier I added this nice little array... + * @var array + */ + private static $NG_EXIT_CODES = array(0, 227, 229); /** * Filepath of "ng" executable (from Nailgun package) @@ -87,7 +96,7 @@ class Minify_NailgunClosureCompiler extends Minify_ClosureCompiler $command = $this->getCommand($options, $tmpFile); - return implode("\n", $this->shell($command, array(self::NG_EXIT_CODE))); + return implode("\n", $this->shell($command, self::$NG_EXIT_CODES)); } private function startServer()