File tree Expand file tree Collapse file tree 1 file changed +22
-14
lines changed
Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -745,22 +745,30 @@ PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
745745 if ((PHPDBG_G (flags ) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING )) != PHPDBG_IS_STOPPING ) {
746746 if (buffered == NULL ) {
747747#ifdef HAVE_PHPDBG_READLINE
748- char * cmd = readline (phpdbg_get_prompt ());
749- PHPDBG_G (last_was_newline ) = 1 ;
748+ /* note: EOF makes readline write prompt again in local console mode
749+ and ignored if compiled without readline */
750+ if (!isatty (PHPDBG_G (io )[PHPDBG_STDIN ].fd )) {
751+ #endif
752+ char buf [PHPDBG_MAX_CMD ];
753+ phpdbg_write ("%s" , phpdbg_get_prompt ());
754+ phpdbg_consume_stdin_line (buf );
755+ buffer = estrdup (buf );
750756
751- if (!cmd ) {
752- PHPDBG_G (flags ) |= PHPDBG_IS_QUITTING ;
753- zend_bailout ();
754- }
757+ #ifdef HAVE_PHPDBG_READLINE
758+
759+ } else {
760+ char * cmd = readline (phpdbg_get_prompt ());
761+ PHPDBG_G (last_was_newline ) = 1 ;
762+
763+ if (!cmd ) {
764+ PHPDBG_G (flags ) |= PHPDBG_IS_QUITTING ;
765+ zend_bailout ();
766+ }
755767
756- add_history (cmd );
757- buffer = estrdup (cmd );
758- free (cmd );
759- #else
760- char buf [PHPDBG_MAX_CMD ];
761- phpdbg_write ("%s" , phpdbg_get_prompt ());
762- phpdbg_consume_stdin_line (buf );
763- buffer = estrdup (buf );
768+ add_history (cmd );
769+ buffer = estrdup (cmd );
770+ free (cmd );
771+ }
764772#endif
765773 } else {
766774 buffer = estrdup (buffered );
You can’t perform that action at this time.
0 commit comments