checkJar(self::$ngJarFile); $this->checkJar(self::$jarFile); $classPath = array( self::$ngJarFile, self::$jarFile, ); // The command for the server that should show up in the process list return array( self::$javaExecutable, '-server', '-cp', implode(':', $classPath), self::NG_SERVER, ); } /** * @throws Minify_ClosureCompiler_Exception * * @return array */ protected function getCompilerCommandLine() { return array( self::$ngExecutable, escapeshellarg(self::CC_MAIN), ); } /** * @param string $tmpFile * @param array $options * * @throws Minify_ClosureCompiler_Exception * * @return string */ protected function compile($tmpFile, $options) { $this->startServer(); $command = $this->getCommand($options, $tmpFile); return implode("\n", $this->shell($command, self::$NG_EXIT_CODES)); } private function startServer() { $serverCommand = implode(' ', $this->getServerCommandLine()); $psCommand = $this->shell('ps -o cmd= -C ' . self::$javaExecutable); if (in_array($serverCommand, $psCommand, true)) { // already started! return; } $this->shell("${serverCommand} /dev/null 2>/dev/null & sleep 10"); } }