diff options
Diffstat (limited to 'zellij-client/src/os_input_output.rs')
-rw-r--r-- | zellij-client/src/os_input_output.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 50e7e2eba..1bfd6666a 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -8,6 +8,7 @@ use nix::pty::Winsize; use nix::sys::termios; use signal_hook::{consts::signal::*, iterator::Signals}; use std::io::prelude::*; +use std::io::IsTerminal; use std::os::unix::io::RawFd; use std::path::Path; use std::sync::{Arc, Mutex}; @@ -97,6 +98,12 @@ pub trait ClientOsApi: Send + Sync { fn get_stdout_writer(&self) -> Box<dyn io::Write>; /// Returns a BufReader that allows to read from STDIN line by line, also locks STDIN fn get_stdin_reader(&self) -> Box<dyn io::BufRead>; + fn stdin_is_terminal(&self) -> bool { + true + } + fn stdout_is_terminal(&self) -> bool { + true + } fn update_session_name(&mut self, new_session_name: String); /// Returns the raw contents of standard input. fn read_from_stdin(&mut self) -> Result<Vec<u8>, &'static str>; @@ -193,6 +200,16 @@ impl ClientOsApi for ClientOsInputOutput { Box::new(stdin.lock()) } + fn stdin_is_terminal(&self) -> bool { + let stdin = ::std::io::stdin(); + stdin.is_terminal() + } + + fn stdout_is_terminal(&self) -> bool { + let stdout = ::std::io::stdout(); + stdout.is_terminal() + } + fn send_to_server(&self, msg: ClientToServerMsg) { // TODO: handle the error here, right now we silently ignore it let _ = self |