Skip to content

Commit

Permalink
non-zero exit code for cli for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bfanger committed Aug 2, 2018
1 parent 33c50b9 commit 1b8c93f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/openapi
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ set_exception_handler(function ($exception) use ($options) {
}
exit($exception->getCode() ?: 1);
});
\OpenApi\Logger::getInstance()->log = function ($entry, $type) use ($options) {
$exit = 0;
\OpenApi\Logger::getInstance()->log = function ($entry, $type) use ($options, &$exit) {
$exit = 1;
$type = $type === E_USER_NOTICE ? 'INFO' : 'WARN';
if ($entry instanceof Exception) {
error_log('[' . $type . '] ' . $entry->getMessage());
Expand Down Expand Up @@ -228,3 +230,4 @@ if ($options['stdout']) {
error_log('Written to '.realpath($options['output']));
}
error_log('');
exit($exit);

0 comments on commit 1b8c93f

Please sign in to comment.