From a3cc2276208e63ca8b21eed414bc08708eb4dd03 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 30 Jul 2016 08:37:13 -0600 Subject: [PATCH] Convert VarError to io::Error (#41) --- src/tty.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.