MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / AttachWindowsConsole

Function AttachWindowsConsole

launcher/console/WindowsConsole.cpp:111–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool AttachWindowsConsole()
112{
113 auto stdinType = GetFileType(GetStdHandle(STD_INPUT_HANDLE));
114 auto stdoutType = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
115 auto stderrType = GetFileType(GetStdHandle(STD_ERROR_HANDLE));
116
117 bool bindStdIn = false;
118 bool bindStdOut = false;
119 bool bindStdErr = false;
120
121 if (stdinType == FILE_TYPE_CHAR || stdinType == FILE_TYPE_UNKNOWN) {
122 bindStdIn = true;
123 }
124 if (stdoutType == FILE_TYPE_CHAR || stdoutType == FILE_TYPE_UNKNOWN) {
125 bindStdOut = true;
126 }
127 if (stderrType == FILE_TYPE_CHAR || stderrType == FILE_TYPE_UNKNOWN) {
128 bindStdErr = true;
129 }
130
131 if (AttachConsole(ATTACH_PARENT_PROCESS)) {
132 BindCrtHandlesToStdHandles(bindStdIn, bindStdOut, bindStdErr);
133 return true;
134 }
135
136 return false;
137}
138
139std::error_code EnableAnsiSupport()
140{

Callers 1

WindowsConsoleGuardMethod · 0.85

Calls 1

Tested by

no test coverage detected