bail on fail for console input, fix - ./phpdbg

This commit is contained in:
krakjoe 2013-11-19 13:11:45 +00:00
parent 73e7f5c645
commit cf4b451d39

View file

@ -129,6 +129,10 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
char buf[PHPDBG_MAX_CMD]; char buf[PHPDBG_MAX_CMD];
if (!phpdbg_write(PROMPT) || if (!phpdbg_write(PROMPT) ||
!fgets(buf, PHPDBG_MAX_CMD, stdin)) { !fgets(buf, PHPDBG_MAX_CMD, stdin)) {
/* the user has gone away */
phpdbg_error("Failed to read console !");
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
zend_bailout();
return NULL; return NULL;
} }
@ -136,6 +140,10 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
#else #else
char *cmd = readline(PROMPT); char *cmd = readline(PROMPT);
if (!cmd) { if (!cmd) {
/* the user has gone away */
phpdbg_error("Failed to read console !");
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
zend_bailout();
return NULL; return NULL;
} }