From 53862f04a0002894c0ef5aeb23d52495e5abe60d Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Sun, 23 Oct 2016 04:32:36 +0300 Subject: KWSys 2016-10-23 (b630d2f5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code extracted from: http://public.kitware.com/KWSys.git at commit b630d2f5575be7d70c214bfffc57aaf5069c6369 (master). Upstream Shortlog ----------------- Dāvis Mosāns (1): b630d2f5 ConsoleBuf: Check for actual console with GetConsoleMode --- ConsoleBuf.hxx.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ConsoleBuf.hxx.in b/ConsoleBuf.hxx.in index 8aeeda1..2496b45 100644 --- a/ConsoleBuf.hxx.in +++ b/ConsoleBuf.hxx.in @@ -239,8 +239,12 @@ namespace @KWSYS_NAMESPACE@ m_activeInputCodepage = input_file_codepage; break; case FILE_TYPE_CHAR: - m_isConsoleInput = true; - break; + // Check for actual console. + DWORD consoleMode; + m_isConsoleInput = GetConsoleMode(m_hInput, &consoleMode) == 0 ? false : true; + if (m_isConsoleInput) { + break; + } case FILE_TYPE_PIPE: m_activeInputCodepage = input_pipe_codepage; break; @@ -259,8 +263,12 @@ namespace @KWSYS_NAMESPACE@ m_activeOutputCodepage = output_file_codepage; break; case FILE_TYPE_CHAR: - m_isConsoleOutput = true; - break; + // Check for actual console. + DWORD consoleMode; + m_isConsoleOutput = GetConsoleMode(m_hOutput, &consoleMode) == 0 ? false : true; + if (m_isConsoleOutput) { + break; + } case FILE_TYPE_PIPE: m_activeOutputCodepage = output_pipe_codepage; break; -- cgit v0.12