diff options
author | Rudolf Polzer <divVerent@xonotic.org> | 2014-11-13 12:24:30 +0100 |
---|---|---|
committer | Rudolf Polzer <divVerent@xonotic.org> | 2014-11-13 12:25:43 +0100 |
commit | 0f30803172011bc7f33d1e382f1ef0302e9d442b (patch) | |
tree | 909a8b7efeefa30627d5f0f35a359effa84c4381 /osdep/terminal-unix.c | |
parent | a09f7a371e1e7cdaf03bfe1d5df43d2fabdf5fdf (diff) | |
download | mpv-0f30803172011bc7f33d1e382f1ef0302e9d442b.tar.bz2 mpv-0f30803172011bc7f33d1e382f1ef0302e9d442b.tar.xz |
terminal-unix: Add some comments about FD use.
Diffstat (limited to 'osdep/terminal-unix.c')
-rw-r--r-- | osdep/terminal-unix.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 13a9143b51..5115666afc 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -268,6 +268,11 @@ static bool read_terminal; static void enable_kx(bool enable) { + // This check is actually always true, as enable_kx calls are all guarded + // by read_terminal, which is true only if both stdin and stdout are a + // tty. Note that stderr being redirected away has no influence over mpv's + // I/O handling except for disabling the terminal OSD, and thus stderr + // shouldn't be relied on here either. if (isatty(STDOUT_FILENO)) { char *cmd = enable ? "\033=" : "\033>"; printf("%s", cmd); @@ -472,6 +477,9 @@ int terminal_init(void) assert(!getch2_enabled); getch2_enabled = 1; + // Disable reading from the terminal even if stdout is not a tty, to make + // mpv ... | less + // do the right thing. read_terminal = isatty(STDIN_FILENO) && isatty(STDOUT_FILENO); // handlers to fix terminal settings |