Re: BUG #16108: Colorization to the output of command-line has unproperly behaviors at Windows platform
Michail Nikolaev <michail.nikolaev@gmail.com>
From: Michail Nikolaev <michail.nikolaev@gmail.com>
To: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: "Tang, Haiying" <tanghy.fnst@cn.fujitsu.com>,
Thomas Munro <thomas.munro@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-02-18T22:39:39Z
Lists: pgsql-bugs, pgsql-hackers
Hello everyone. > Please find attached a version that supports older Mingw versions and SDKs. I have checked the patch source code and it seems to be working. But a few moments I want to mention: I think it is not good idea to mix the logic of detecting the fact of TTY with enabling of the VT100 mode. Yeah, it seems to be correct for current case but a little confusing. Maybe is it better to detect terminal using *isatty* and later call *enable_vt_mode*? Also, it seems like if GetConsoleMode returns ENABLE_VIRTUAL_TERMINAL_PROCESSING flag already set - we could skip SetConsoleMode call (not a big deal of course). Thanks, Michail.
Commits
-
Fix command-line colorization on Windows with VT100-compatible environments
- 3b5709e664c4 12.3 landed
- 3b77dce863d9 13.0 landed