Skip to content

Commit 7aa2be0

Browse files
committed
Fix readline/libedit build
1 parent f0b5096 commit 7aa2be0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sapi/phpdbg/phpdbg_cmd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
716716
#define USE_LIB_STAR (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT))
717717
/* note: EOF makes readline write prompt again in local console mode - and ignored if compiled without readline */
718718
#if USE_LIB_STAR
719-
if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDOUT].fd))
719+
if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd))
720720
#endif
721721
{
722722
phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());
@@ -726,9 +726,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
726726
else {
727727
cmd = readline(phpdbg_get_prompt());
728728
PHPDBG_G(last_was_newline) = 1;
729-
}
730729

731-
if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
732730
if (!cmd) {
733731
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING | PHPDBG_IS_DISCONNECTED;
734732
zend_bailout();
@@ -744,7 +742,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
744742
buffer = estrdup(cmd);
745743

746744
#if USE_LIB_STAR
747-
if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
745+
if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd)) {
748746
free(cmd);
749747
}
750748
#endif

0 commit comments

Comments
 (0)