summaryrefslogtreecommitdiffstats
path: root/osdep/terminal-unix.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-01-04 21:01:01 +0100
committersfan5 <sfan5@live.de>2024-01-15 10:39:42 +0100
commit13ed292ab054ba09f9257d9c510cd7ce39f4b7d3 (patch)
tree5004e185c7a6b031a42f71cce4212f0331c7c95e /osdep/terminal-unix.c
parentab60ad861971c5c01c877ee7d0b897ea285bd0e9 (diff)
downloadmpv-13ed292ab054ba09f9257d9c510cd7ce39f4b7d3.tar.bz2
mpv-13ed292ab054ba09f9257d9c510cd7ce39f4b7d3.tar.xz
terminal: don't print escape sequence if not tty
Diffstat (limited to 'osdep/terminal-unix.c')
-rw-r--r--osdep/terminal-unix.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index 72d0d14899..be0463b871 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -424,8 +424,10 @@ static MP_THREAD_VOID terminal_thread(void *ptr)
(void)read(stop_cont_pipe[0], &c, 1);
if (c == PIPE_STOP) {
do_deactivate_getch2();
- (void)write(STDERR_FILENO, TERM_ESC_RESTORE_CURSOR,
- sizeof(TERM_ESC_RESTORE_CURSOR) - 1);
+ if (isatty(STDERR_FILENO)) {
+ (void)write(STDERR_FILENO, TERM_ESC_RESTORE_CURSOR,
+ sizeof(TERM_ESC_RESTORE_CURSOR) - 1);
+ }
// trying to reset SIGTSTP handler to default and raise it will
// result in a race and there's no other way to invoke the
// default handler. so just invoke SIGSTOP since it's