pub struct TtyHandle { /* private fields */ }
Expand description
TTY handles represent a stream for the console.
Implementations§
source§impl TtyHandle
impl TtyHandle
sourcepub fn new(loop: &Loop, fd: i32) -> Result<TtyHandle>
pub fn new(loop: &Loop, fd: i32) -> Result<TtyHandle>
Initialize a new TTY stream with the given file descriptor. Usually the file descriptor will be:
0 = stdin 1 = stdout 2 = stderr
On Unix this function will determine the path of the fd of the terminal using ttyname_r(3), open it, and use it if the passed file descriptor refers to a TTY. This lets libuv put the tty in non-blocking mode without affecting other processes that share the tty.
This function is not thread safe on systems that don’t support ioctl TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and Solaris.
Note: If reopening the TTY fails, libuv falls back to blocking writes.
sourcepub fn set_mode(&mut self, mode: TtyMode) -> Result<()>
pub fn set_mode(&mut self, mode: TtyMode) -> Result<()>
Set the TTY using the specified terminal mode.
sourcepub fn reset_mode() -> Result<()>
pub fn reset_mode() -> Result<()>
To be called when the program exits. Resets TTY settings to default values for the next process to take over.
This function is async signal-safe on Unix platforms but can fail with error code EBUSY if you call it when execution is inside uv_tty_set_mode().
sourcepub fn get_winsize(&self) -> Result<(i32, i32)>
pub fn get_winsize(&self) -> Result<(i32, i32)>
Gets the current Window size.
sourcepub fn set_vterm_state(state: VTermState)
pub fn set_vterm_state(state: VTermState)
Controls whether console virtual terminal sequences are processed by libuv or console. Useful in particular for enabling ConEmu support of ANSI X3.64 and Xterm 256 colors. Otherwise Windows10 consoles are usually detected automatically.
This function is only meaningful on Windows systems. On Unix it is silently ignored.
sourcepub fn get_vterm_state() -> Result<VTermState>
pub fn get_vterm_state() -> Result<VTermState>
Get the current state of whether console virtual terminal sequences are handled by libuv or the console.
This function is not implemented on Unix, where it returns UV_ENOTSUP.