Remove dependency on `atty` and use `std::io::IsTerminal` instead
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Lena · committed by David Peter · parent 7696523 · Browse files · 3 files·+3 added−26 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+3 added−26 removed
- other:+3 added−26 removed
Provenance
- Commit
69ee173- Tree
b0db946- Author
Lena <126529524+acuteenvy@users.noreply.github.com>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
7696523
3 files changed+3 added−26 removed
modified:src/options.rs+2 added-2 removed
1 use std::fs::File;2+use std::io::IsTerminal;3 use std::path::PathBuf;4 use std::process::{Command, Stdio};5 use std::{cmp, env, fmt, io};6 7 use anyhow::ensure;7-use atty::Stream;8 use clap::ArgMatches;9 10 use crate::command::Commands;11 use crate::error::OptionsError;320 unmodified lines332 Some("color") => OutputStyleOption::Color,333 Some("none") => OutputStyleOption::Disabled,334 _ => {335 if options.command_output_policy == CommandOutputPolicy::Inherit336- || !atty::is(Stream::Stdout)336+ || !io::stdout().is_terminal()337 {338 OutputStyleOption::Basic339 } else if env::var_os("TERM")340 .map(|t| t == "unknown" || t == "dumb")141 unmodified linesmodified:Cargo.lock+1 added-22 removed
116 unmodified lines117 "wait-timeout",118 ]119 120 [[package]]121-name = "atty"122-version = "0.2.14"123-source = "registry+https://github.com/rust-lang/crates.io-index"124-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"125-dependencies = [126- "hermit-abi 0.1.19",127- "libc",128- "winapi",129-]130-131-[[package]]121 name = "autocfg"122 version = "0.1.8"123 source = "registry+https://github.com/rust-lang/crates.io-index"124 checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"329 unmodified lines454 ]455 456 [[package]]457 name = "hermit-abi"469-version = "0.1.19"470-source = "registry+https://github.com/rust-lang/crates.io-index"471-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"472-dependencies = [473- "libc",474-]475-476-[[package]]477-name = "hermit-abi"458 version = "0.3.3"459 source = "registry+https://github.com/rust-lang/crates.io-index"460 checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"461 3 unmodified lines465 dependencies = [466 "anyhow",467 "approx",468 "assert_cmd",489- "atty",469 "clap",470 "clap_complete",471 "colored",472 "csv",40 unmodified lines513 version = "0.4.9"514 source = "registry+https://github.com/rust-lang/crates.io-index"515 checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"516 dependencies = [538- "hermit-abi 0.3.3",517+ "hermit-abi",518 "rustix",519 "windows-sys 0.48.0",520 ]521 886 unmodified linesmodified:Cargo.toml-2 removed
18 unmodified lines19202122232324252632 unmodified lines5960616264636465662 unmodified lines18 unmodified lines[dependencies]colored = "2.0"indicatif = "=0.17.4"statistical = "1.0"atty = "0.2"csv = "1.1"serde = { version = "1.0", features = ["derive"] }serde_json = "1.0"rust_decimal = "1.31"32 unmodified linestempfile = "3.3"
[build-dependencies]clap = "4.0.18"atty = "0.2"clap_complete = "4.2.1"
[profile.release]lto = true2 unmodified lines