Skip to content

Commit 2ef327c

Browse files
committed
Exempt paging from -qrr mode
1 parent 1149833 commit 2ef327c

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

sapi/phpdbg/phpdbg.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ int main(int argc, char **argv) /* {{{ */
18451845
quit_immediately = phpdbg_startup_run > 1;
18461846
phpdbg_startup_run = 0;
18471847
if (quit_immediately) {
1848-
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE | PHPDBG_PREVENT_INTERACTIVE;
1848+
PHPDBG_G(flags) = (PHPDBG_G(flags) & ~PHPDBG_HAS_PAGINATION) | PHPDBG_IS_INTERACTIVE | PHPDBG_PREVENT_INTERACTIVE;
18491849
} else {
18501850
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
18511851
}

sapi/phpdbg/phpdbg_io.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ static int phpdbg_output_pager(int sock, const char *ptr, int len) {
202202
bytes += write(sock, ptr + bytes, (p - ptr) - bytes);
203203

204204
if (memchr(p, '\n', endp - p)) {
205-
int chr;
206-
printf("\r---Type <return> to continue or q <return> to quit---");
207-
chr = getchar();
208-
if (chr == 'q') {
205+
char buf[PHPDBG_MAX_CMD];
206+
write(sock, ZEND_STRL("\r---Type <return> to continue or q <return> to quit---"));
207+
phpdbg_consume_stdin_line(buf);
208+
if (*buf == 'q') {
209209
break;
210210
}
211-
printf("\r");
211+
write(sock, "\r", 1);
212212
} else break;
213213
}
214214
}
@@ -225,9 +225,10 @@ PHPDBG_API int phpdbg_mixed_write(int sock, const char *ptr, int len) {
225225
return phpdbg_send_bytes(sock, ptr, len);
226226
}
227227

228-
if (PHPDBG_G(flags) & PHPDBG_HAS_PAGINATION
229-
&& PHPDBG_G(io)[PHPDBG_STDOUT].fd == sock
230-
&& PHPDBG_G(lines) > 0) {
228+
if ((PHPDBG_G(flags) & PHPDBG_HAS_PAGINATION)
229+
&& !(PHPDBG_G(flags) & PHPDBG_WRITE_XML)
230+
&& PHPDBG_G(io)[PHPDBG_STDOUT].fd == sock
231+
&& PHPDBG_G(lines) > 0) {
231232
return phpdbg_output_pager(sock, ptr, len);
232233
}
233234

0 commit comments

Comments
 (0)