Skip to content

Commit 8eadce7

Browse files
upgrade terminal_size to 0.4
1 parent 9e0bc0f commit 8eadce7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rust-version = "1.75" # Could perhaps be even older, but this is 2 years at tim
1212

1313
[dependencies]
1414
atty = "0.2"
15-
terminal_size = "0.2"
15+
terminal_size = "0.4"
1616
yansi = "0.5"
1717

1818
[dev-dependencies]

src/width.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use terminal_size::Width;
66
#[cfg(unix)]
77
pub(crate) fn stdout_width() -> Option<usize> {
8-
terminal_size::terminal_size_using_fd(1).map(|(Width(w), _)| w as usize)
8+
unsafe {
9+
terminal_size::terminal_size_using_fd(1).map(|(Width(w), _)| w as usize)
10+
}
911
}
1012

1113
#[cfg(windows)]
@@ -16,7 +18,9 @@ pub(crate) fn stdout_width() -> Option<usize> {
1618

1719
#[cfg(unix)]
1820
pub(crate) fn stderr_width() -> Option<usize> {
19-
terminal_size::terminal_size_using_fd(2).map(|(Width(w), _)| w as usize)
21+
unsafe {
22+
terminal_size::terminal_size_using_fd(2).map(|(Width(w), _)| w as usize)
23+
}
2024
}
2125

2226
#[cfg(windows)]

0 commit comments

Comments
 (0)