From 8eadce7fba0cf2d7df97959c439ffb2ec761be7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kj=C3=A4ll?= Date: Fri, 6 Mar 2026 17:38:33 +0100 Subject: [PATCH] upgrade terminal_size to 0.4 --- Cargo.toml | 2 +- src/width.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f4f09f7..9de07b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.75" # Could perhaps be even older, but this is 2 years at tim [dependencies] atty = "0.2" -terminal_size = "0.2" +terminal_size = "0.4" yansi = "0.5" [dev-dependencies] diff --git a/src/width.rs b/src/width.rs index d1f8f16..f041c6d 100644 --- a/src/width.rs +++ b/src/width.rs @@ -5,7 +5,9 @@ use terminal_size::Width; #[cfg(unix)] pub(crate) fn stdout_width() -> Option { - terminal_size::terminal_size_using_fd(1).map(|(Width(w), _)| w as usize) + unsafe { + terminal_size::terminal_size_using_fd(1).map(|(Width(w), _)| w as usize) + } } #[cfg(windows)] @@ -16,7 +18,9 @@ pub(crate) fn stdout_width() -> Option { #[cfg(unix)] pub(crate) fn stderr_width() -> Option { - terminal_size::terminal_size_using_fd(2).map(|(Width(w), _)| w as usize) + unsafe { + terminal_size::terminal_size_using_fd(2).map(|(Width(w), _)| w as usize) + } } #[cfg(windows)]