diff --git a/src/tty.rs b/src/tty.rs index c02d8e1..7413dcf 100644 --- a/src/tty.rs +++ b/src/tty.rs @@ -21,7 +21,8 @@ pub fn is_tty(_stream: T) -> bool { #[cfg(target_os = "redox")] pub fn get_tty() -> io::Result { use std::env; - fs::OpenOptions::new().read(true).write(true).open(try!(env::var("TTY"))) + let tty = try!(env::var("TTY").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))); + fs::OpenOptions::new().read(true).write(true).open(tty) } /// Get the TTY device.