fixed termsize panic when output is redirected
parent
83901d28a5
commit
7923c7e778
|
@ -1,6 +1,8 @@
|
||||||
|
use termsize::Size;
|
||||||
|
|
||||||
pub trait TerminalSize {
|
pub trait TerminalSize {
|
||||||
fn get_width(&self) -> usize {
|
fn get_width(&self) -> usize {
|
||||||
let terminal = termsize::get().unwrap();
|
let terminal: Size = termsize::get().unwrap_or(Size { rows: 150, cols: 150 });
|
||||||
terminal.cols.into()
|
terminal.cols.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue