Crate ctty[][src]

ctty-rs is a cross-platform crate for determining a processes' controlling TTY (ctty). Support is currently available for Linux, macOS, and FreeBSD.

In many cases, it may be useful to know which TTY a process belongs to (for example, when storing session data), but there is no standardized way to do this across operating systems. One way is to use ttyname on stdin, stout, or stderr's file descriptors, but this doesn't work in cases where they are redirected at the shell level.

ctty-rs provides a simple way to obtain a processes' controlling TTY even when stdin, stdout, and stderr with a platform-agnostic interface.





Returns the dev_t corresponding to the current process's controlling tty


Returns a full path to a tty or pseudo tty that corresponds with the given dev_t