msg: print MSGL_WARN and higher error messages to stderr

mpv has a convention of printing everything to stdout. The reasons for
this are pretty unclear and in certain situations rather unintuitive. It
leads to some bad behavior in fringe cases with encoding mode and isn't
the norm for programs so just adjust it so warnings and up are printed
to stderr. Fixes #8608.
This commit is contained in:
Dudemanguy 2023-07-01 10:03:02 -05:00 committed by sfan5
parent 99f367f219
commit 4939570e17
1 changed files with 2 additions and 1 deletions

View File

@ -306,7 +306,8 @@ static void print_terminal_line(struct mp_log *log, int lev,
return;
struct mp_log_root *root = log->root;
FILE *stream = (root->force_stderr || lev == MSGL_STATUS) ? stderr : stdout;
FILE *stream = (root->force_stderr || lev == MSGL_STATUS || lev == MSGL_FATAL ||
lev == MSGL_ERR || lev == MSGL_WARN) ? stderr : stdout;
if (lev != MSGL_STATUS)
flush_status_line(root);