diff --git a/Cargo.lock b/Cargo.lock index 09b806d03..7b794798c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" @@ -89,17 +89,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.2.0" @@ -108,17 +97,17 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -217,9 +206,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "color-eyre" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" +checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" dependencies = [ "backtrace", "color-spantrace", @@ -232,9 +221,9 @@ dependencies = [ [[package]] name = "color-spantrace" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" +checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" dependencies = [ "once_cell", "owo-colors", @@ -397,9 +386,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "globset" @@ -426,15 +415,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.9" @@ -511,7 +491,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi", "libc", "windows-sys", ] @@ -545,9 +525,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "libredox" @@ -579,11 +559,11 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -608,9 +588,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -623,11 +603,12 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "owo-colors" -version = "3.5.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" dependencies = [ - "supports-color", + "supports-color 2.1.0", + "supports-color 3.0.2", ] [[package]] @@ -696,9 +677,9 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc_version" @@ -840,11 +821,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "supports-color" -version = "1.3.1" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" +dependencies = [ + "is-terminal", + "is_ci", +] + +[[package]] +name = "supports-color" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" dependencies = [ - "atty", "is_ci", ] @@ -1133,9 +1123,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1149,51 +1139,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" diff --git a/Cargo.toml b/Cargo.toml index 81216c9e1..1cd7b5fd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ members = ["xtask"] [dependencies] is-terminal = "0.4.2" clap = { version = "4.1.4", features = ["derive"] } -color-eyre = { version = "0.6.2", default-features = false, features = ["track-caller"] } +color-eyre = { version = "0.6.5", default-features = false, features = ["track-caller"] } eyre = "0.6.8" thiserror = "1.0.38" home = "0.5.4" @@ -46,7 +46,7 @@ signal-hook = { version = "0.3.15" } directories = "4.0.1" walkdir = { version = "2.3.2", optional = true } tempfile = "3.3.0" -owo-colors = { version = "3.5.0", features = ["supports-colors"] } +owo-colors = { version = "4.0", features = ["supports-colors"] } semver = "1.0.16" is_ci = "1.1.1" diff --git a/deny.toml b/deny.toml index 0df3b2d50..b9c4af19d 100644 --- a/deny.toml +++ b/deny.toml @@ -9,12 +9,6 @@ targets = [ [advisories] version = 2 -ignore = [ - # FIXME: remove this if/when clap changes to is-terminal, atty is - # patched, or we migrated to an MSRV of 1.66.0. - "RUSTSEC-2021-0145", - "RUSTSEC-2024-0375" -] [bans] multiple-versions = "deny" diff --git a/src/bin/commands/containers.rs b/src/bin/commands/containers.rs index 530a3a8d9..c8e505c6a 100644 --- a/src/bin/commands/containers.rs +++ b/src/bin/commands/containers.rs @@ -3,8 +3,9 @@ use std::io; use clap::{Args, Subcommand}; use cross::docker::ImagePlatform; use cross::rustc::{QualifiedToolchain, Toolchain}; -use cross::shell::{MessageInfo, Stream}; +use cross::shell::MessageInfo; use cross::{docker, CommandExt, TargetTriple}; +use is_terminal::IsTerminal; #[derive(Args, Debug)] pub struct ListVolumes { @@ -327,7 +328,8 @@ pub fn create_persistent_volume( docker.arg("--rm"); docker.args(["-v", &format!("{}:{}", volume_id, mount_prefix)]); docker.arg("-d"); - let is_tty = io::Stdin::is_atty() && io::Stdout::is_atty() && io::Stderr::is_atty(); + let is_tty = + io::stdin().is_terminal() && io::stdout().is_terminal() && io::stderr().is_terminal(); if is_tty { docker.arg("-t"); } diff --git a/src/docker/local.rs b/src/docker/local.rs index bd6f9ca30..9ae52c897 100644 --- a/src/docker/local.rs +++ b/src/docker/local.rs @@ -7,8 +7,9 @@ use super::shared::*; use crate::errors::Result; use crate::extensions::CommandExt; use crate::file::{PathExt, ToUtf8}; -use crate::shell::{MessageInfo, Stream}; +use crate::shell::MessageInfo; use eyre::Context; +use is_terminal::IsTerminal; // NOTE: host path must be absolute fn mount( @@ -136,7 +137,7 @@ pub(crate) fn run( ]); } - if io::Stdin::is_atty() && io::Stdout::is_atty() && io::Stderr::is_atty() { + if io::stdin().is_terminal() && io::stdout().is_terminal() && io::stderr().is_terminal() { docker.arg("-t"); } diff --git a/src/docker/remote.rs b/src/docker/remote.rs index b8c9ee803..b6e553770 100644 --- a/src/docker/remote.rs +++ b/src/docker/remote.rs @@ -5,6 +5,7 @@ use std::process::{Command, ExitStatus}; use std::{env, fs, time}; use eyre::Context; +use is_terminal::IsTerminal; use super::engine::Engine; use super::shared::*; @@ -13,7 +14,7 @@ use crate::errors::Result; use crate::extensions::CommandExt; use crate::file::{self, PathExt, ToUtf8}; use crate::rustc::{self, QualifiedToolchain, VersionMetaExt}; -use crate::shell::{MessageInfo, Stream}; +use crate::shell::MessageInfo; use crate::temp; use crate::TargetTriple; @@ -774,7 +775,8 @@ pub(crate) fn run( } docker.arg("-d"); - let is_tty = io::Stdin::is_atty() && io::Stdout::is_atty() && io::Stderr::is_atty(); + let is_tty = + io::stdin().is_terminal() && io::stdout().is_terminal() && io::stderr().is_terminal(); if is_tty { docker.arg("-t"); } diff --git a/src/shell.rs b/src/shell.rs index 8c88430c6..59dbbe63b 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -8,7 +8,6 @@ use std::str::FromStr; use crate::config::bool_from_envvar; use crate::errors::Result; -use is_terminal::IsTerminal; use owo_colors::{self, OwoColorize}; // get the prefix for stderr messages @@ -201,7 +200,7 @@ impl MessageInfo { self.as_verbosity(call, Verbosity::Verbose(2)) } - fn erase_line(&mut self, stream: &mut S) -> Result<()> { + fn erase_line(&mut self, stream: &mut S) -> Result<()> { // this is the Erase in Line sequence stream.write_all(b"\x1B[K").map_err(Into::into) } @@ -449,42 +448,19 @@ fn get_verbosity( }) } -pub trait Stream { - type TTY: IsTerminal; - const OWO: owo_colors::Stream; - - #[must_use] - fn is_atty() -> bool; - - fn owo(&self) -> owo_colors::Stream { - Self::OWO - } +trait OwoStream { + fn owo(&self) -> owo_colors::Stream; } -impl Stream for io::Stdin { - type TTY = io::Stdin; - const OWO: owo_colors::Stream = owo_colors::Stream::Stdin; - - fn is_atty() -> bool { - io::stdin().is_terminal() - } -} - -impl Stream for io::Stdout { - type TTY = io::Stdout; - const OWO: owo_colors::Stream = owo_colors::Stream::Stdout; - - fn is_atty() -> bool { - io::stdout().is_terminal() +impl OwoStream for io::Stdout { + fn owo(&self) -> owo_colors::Stream { + owo_colors::Stream::Stdout } } -impl Stream for io::Stderr { - type TTY = io::Stderr; - const OWO: owo_colors::Stream = owo_colors::Stream::Stderr; - - fn is_atty() -> bool { - io::stderr().is_terminal() +impl OwoStream for io::Stderr { + fn owo(&self) -> owo_colors::Stream { + owo_colors::Stream::Stderr } }