MCPcopy Create free account
hub / github.com/apache/cloudberry / enable_vt_processing

Function enable_vt_processing

src/common/logging.c:51–74  ·  view source on GitHub ↗

* Attempt to enable VT100 sequence processing for colorization on Windows. * If current environment is not VT100-compatible or if this mode could not * be enabled, return false. */

Source from the content-addressed store, hash-verified

49 * be enabled, return false.
50 */
51static bool
52enable_vt_processing(void)
53{
54 /* Check stderr */
55 HANDLE hOut = GetStdHandle(STD_ERROR_HANDLE);
56 DWORD dwMode = 0;
57
58 if (hOut == INVALID_HANDLE_VALUE)
59 return false;
60
61 /*
62 * Look for the current console settings and check if VT100 is already
63 * enabled.
64 */
65 if (!GetConsoleMode(hOut, &dwMode))
66 return false;
67 if ((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0)
68 return true;
69
70 dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
71 if (!SetConsoleMode(hOut, dwMode))
72 return false;
73 return true;
74}
75#endif /* WIN32 */
76
77/*

Callers 1

pg_logging_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected