This commit is contained in:
Ticki 2016-04-02 18:24:47 +02:00
parent f5936c0035
commit bf1a6ecc2e
1 changed files with 2 additions and 2 deletions

View File

@ -50,8 +50,8 @@ pub fn terminal_size() -> io::Result<(usize, usize)> {
pub fn terminal_size() -> io::Result<(usize, usize)> {
use std::env;
let width = env::var("COLUMNS").unwrap_or(String::new()).parse::<usize>().unwrap_or(0);
let height = env::var("LINES").unwrap_or(String::new()).parse::<usize>().unwrap_or(0);
let width = try!(env::var("COLUMNS").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))).parse().unwrap_or(0);
let height = try!(env::var("LINES").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))).parse().unwrap_or(0);
Ok((width, height))
}