* @brief True when a std handle is wired to a pipe or disk file (redirection, not a console). */
| 181 | * @brief True when a std handle is wired to a pipe or disk file (redirection, not a console). |
| 182 | */ |
| 183 | static bool handleIsRedirected(DWORD stdHandle) |
| 184 | { |
| 185 | const HANDLE h = GetStdHandle(stdHandle); |
| 186 | if (h == nullptr || h == INVALID_HANDLE_VALUE) |
| 187 | return false; |
| 188 | |
| 189 | const DWORD type = GetFileType(h) & ~static_cast<DWORD>(FILE_TYPE_REMOTE); |
| 190 | return type == FILE_TYPE_DISK || type == FILE_TYPE_PIPE; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * @brief Wires a CRT stream to the inherited std handle so a GUI-subsystem build honors |