public function output($filename, $input)
{
$output = null;
$paths = [getcwd(), dirname(dirname(dirname(dirname(__DIR__))))];
$jar = $this->_findExecutable($paths, $this->_settings['path']);
// Closure works better if you specify an input file. Also supress warnings by default
$tmpFile = tempnam(TMP, 'CLOSURE');
file_put_contents($tmpFile, $input);
$options = array('js' => $tmpFile) + $this->_settings;
$options = array_diff_key($options, array('path' => null, 'paths' => null, 'target' => null, 'theme' => null));
$cmd = 'java -jar "' . $jar . '"';
foreach ($options as $key => $value) {
$cmd .= sprintf(' --%s="%s"', $key, $value);
}
try {
$output = $this->_runCmd($cmd, null);
} catch (Exception $e) {
//If there is an error need to remove tmpFile.
// @codingStandardsIgnoreStart
@unlink($tmpFile);
// @codingStandardsIgnoreEnd
throw $e;
}
// @codingStandardsIgnoreStart
@unlink($tmpFile);
// @codingStandardsIgnoreEnd
return $output;
}