mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-01 12:22:09 +00:00
avutil/log: fix detecting console mode on Win32
A redirected stderr can still have a valid handle. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
bad8feb5e6
commit
1b34c0690f
@ -124,7 +124,10 @@ static void check_color_terminal(void)
|
|||||||
{
|
{
|
||||||
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
|
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
|
||||||
CONSOLE_SCREEN_BUFFER_INFO con_info;
|
CONSOLE_SCREEN_BUFFER_INFO con_info;
|
||||||
|
DWORD dummy;
|
||||||
con = GetStdHandle(STD_ERROR_HANDLE);
|
con = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
|
if (con != INVALID_HANDLE_VALUE && !GetConsoleMode(con, &dummy))
|
||||||
|
con = INVALID_HANDLE_VALUE;
|
||||||
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("AV_LOG_FORCE_NOCOLOR");
|
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("AV_LOG_FORCE_NOCOLOR");
|
||||||
if (use_color) {
|
if (use_color) {
|
||||||
GetConsoleScreenBufferInfo(con, &con_info);
|
GetConsoleScreenBufferInfo(con, &con_info);
|
||||||
|
Loading…
Reference in New Issue
Block a user