From: Anatol Belski Date: Mon, 24 Jul 2017 12:47:32 +0000 (+0200) Subject: Combine conditions for the automatic interactive console activation X-Git-Tag: php-7.2.0beta2~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a6afbef3f003e8faaeb560f9a7dbfbf7a8b1568;p=php Combine conditions for the automatic interactive console activation as with bug #74979 it seems to have regressions which were not present before. --- 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;