Commit b630d2f5 authored by Dāvis Mosāns's avatar Dāvis Mosāns

ConsoleBuf: Check for actual console with GetConsoleMode

In some cases GetFileType returns FILE_TYPE_CHAR even if it isn't
actual console.

Change-Id: I84b6b7b8b3eebc840fd5464cf1de2e9be24f427e
parent dfe9b386
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment