terminal: don't print escape sequence if not tty

This commit is contained in:
Kacper Michajłow
2024-01-04 21:01:01 +01:00
committed by sfan5
parent ab60ad8619
commit 13ed292ab0
2 changed files with 7 additions and 3 deletions

View File

@@ -257,7 +257,9 @@ void mp_msg_flush_status_line(struct mp_log *log, bool clear)
goto done;
if (!clear) {
fprintf(stderr, TERM_ESC_RESTORE_CURSOR "\n");
if (log->root->isatty[STDERR_FILENO])
fprintf(stderr, TERM_ESC_RESTORE_CURSOR);
fprintf(stderr, "\n");
log->root->blank_lines = 0;
log->root->status_lines = 0;
goto done;