From 8a6afbef3f003e8faaeb560f9a7dbfbf7a8b1568 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 24 Jul 2017 14:47:32 +0200 Subject: [PATCH] Combine conditions for the automatic interactive console activation as with bug #74979 it seems to have regressions which were not present before. --- win32/console.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/win32/console.c b/win32/console.c index c321a37023..0d52fd12d8 100644 --- a/win32/console.c +++ b/win32/console.c @@ -94,10 +94,18 @@ PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL e PHP_WINUTIL_API BOOL php_win32_console_is_own(void) {/*{{{*/ - CONSOLE_SCREEN_BUFFER_INFO csbi; + if (!IsDebuggerPresent()) { + CONSOLE_SCREEN_BUFFER_INFO csbi; + DWORD pl[1]; + BOOL ret0 = FALSE, ret1 = FALSE; - if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) && !IsDebuggerPresent()) { - return !csbi.dwCursorPosition.X && !csbi.dwCursorPosition.Y; + if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) { + ret0 = !csbi.dwCursorPosition.X && !csbi.dwCursorPosition.Y; + } + + ret1 = GetConsoleProcessList(pl, 1) == 1; + + return ret0 && ret1; } return FALSE; -- 2.40.0