Skip to content

Commit

Permalink
Merge pull request mrclay#18 from meven/master
Browse files Browse the repository at this point in the history
YUICompressor should alert when java executable is not found or went wrong (issue mrclay#17)
  • Loading branch information
mrclay committed Jan 20, 2012
2 parents 945c2b4 + b95ce11 commit 6507836
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion min/lib/Minify/YUICompressor.php
Expand Up @@ -90,8 +90,11 @@ private static function _minify($type, $content, $options)
throw new Exception('Minify_YUICompressor : could not create temp file.');
}
file_put_contents($tmpFile, $content);
exec(self::_getCmd($options, $type, $tmpFile), $output);
exec(self::_getCmd($options, $type, $tmpFile), $output, $result_code);
unlink($tmpFile);
if ($result_code != 0) {
throw new Exception('Minify_YUICompressor : YUI compressor execution failed.');
}
return implode("\n", $output);
}

Expand Down Expand Up @@ -131,6 +134,9 @@ private static function _prepare()
if (! is_file(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
}
if (! is_executable(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not executable.');
}
if (! is_dir(self::$tempDir)) {
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
}
Expand Down

0 comments on commit 6507836

Please sign in to comment.