com php-src: Always properly show exit status in phpdbg: sapi/phpdbg/phpdbg.c
| From: | Bob Weinand | Date: | Sat, 19 Sep 2015 16:30:07 +0000 |
| Subject: | com php-src: Always properly show exit status in phpdbg: sapi/phpdbg/phpdbg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89077@lists.php.net to get a copy of this message | ||
Commit: 8f85dc141a74ea12f794cf5d719728f4d6f02843
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 19 Sep 2015 18:30:07 +0200
Parents: 16cde23eb24e3675219352dcf970c311c3f7fb40
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8f85dc141a74ea12f794cf5d719728f4d6f02843
Log:
Always properly show exit status in phpdbg
Especially when it is only set after main run (e.g. register_shutdown_function)
Changed paths:
M sapi/phpdbg/phpdbg.c
Diff:
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index de87242..bf3a451 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg..c
@@ -1305,7 +1305,7 @@ int main(int argc, char **argv) /* {{{ */
zend_bool ext_stmt = 0;
zend_bool use_mm_wrappers = 0;
zend_bool is_exit;
- int exit_status = 0;
+ int exit_status;
#ifdef ZTS
void ***tsrm_ls;
@@ -1359,6 +1359,7 @@ phpdbg_main:
php_optind = 1;
opt = 0;
sapi_name = NULL;
+ exit_status = 0;
if (settings) {
exec = settings->exec;
}
@@ -1971,6 +1972,10 @@ phpdbg_out:
php_request_shutdown(NULL);
} zend_end_try();
+ if (exit_status == 0) {
+ exit_status = EG(exit_status);
+ }
+
if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
if (PHPDBG_G(in_execution) || is_exit) {
if (!quit_immediately && !phpdbg_startup_run) {