Skip to content

Commit 8a6afbe

Browse files
committed
Combine conditions for the automatic interactive console activation
as with bug #74979 it seems to have regressions which were not present before.
1 parent 742895f commit 8a6afbe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

win32/console.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,18 @@ PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL e
9494

9595
PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
9696
{/*{{{*/
97-
CONSOLE_SCREEN_BUFFER_INFO csbi;
97+
if (!IsDebuggerPresent()) {
98+
CONSOLE_SCREEN_BUFFER_INFO csbi;
99+
DWORD pl[1];
100+
BOOL ret0 = FALSE, ret1 = FALSE;
98101

99-
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) && !IsDebuggerPresent()) {
100-
return !csbi.dwCursorPosition.X && !csbi.dwCursorPosition.Y;
102+
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) {
103+
ret0 = !csbi.dwCursorPosition.X && !csbi.dwCursorPosition.Y;
104+
}
105+
106+
ret1 = GetConsoleProcessList(pl, 1) == 1;
107+
108+
return ret0 && ret1;
101109
}
102110

103111
return FALSE;

0 commit comments

Comments
 (0)