[cli] exit non-zero if there's a fatal error
This commit is contained in:
parent
a647f700e2
commit
dee7df256c
1 changed files with 5 additions and 0 deletions
|
@ -94,11 +94,13 @@ try {
|
||||||
if (function_exists("fastcgi_finish_request")) {
|
if (function_exists("fastcgi_finish_request")) {
|
||||||
fastcgi_finish_request();
|
fastcgi_finish_request();
|
||||||
}
|
}
|
||||||
|
$exit_code = 0;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if ($database && $database->is_transaction_open()) {
|
if ($database && $database->is_transaction_open()) {
|
||||||
$database->rollback();
|
$database->rollback();
|
||||||
}
|
}
|
||||||
_fatal_error($e);
|
_fatal_error($e);
|
||||||
|
$exit_code = 1;
|
||||||
} finally {
|
} finally {
|
||||||
$_tracer->end();
|
$_tracer->end();
|
||||||
if (TRACE_FILE) {
|
if (TRACE_FILE) {
|
||||||
|
@ -114,3 +116,6 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI == 'phpdbg') {
|
||||||
|
exit($exit_code);
|
||||||
|
}
|
Reference in a new issue