Skip to content
Myr

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

3 files+3 added−26 removed

modified:src/options.rs+2 added-2 removed
1use std::fs::File;2use std::io::IsTerminal;3use std::path::PathBuf;4use std::process::{Command, Stdio};5use std::{cmp, env, fmt, io};67use anyhow::ensure;7use atty::Stream;8use clap::ArgMatches;910use crate::command::Commands;11use crate::error::OptionsError;
320 unmodified lines
332 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 lines
modified:Cargo.lock+1 added-22 removed
116 unmodified lines
117 "wait-timeout",118]119120[[package]]121name = "atty"122version = "0.2.14"123source = "registry+https://github.com/rust-lang/crates.io-index"124checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"125dependencies = [126 "hermit-abi 0.1.19",127 "libc",128 "winapi",129]130131[[package]]121name = "autocfg"122version = "0.1.8"123source = "registry+https://github.com/rust-lang/crates.io-index"124checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"
329 unmodified lines
454]455456[[package]]457name = "hermit-abi"469version = "0.1.19"470source = "registry+https://github.com/rust-lang/crates.io-index"471checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"472dependencies = [473 "libc",474]475476[[package]]477name = "hermit-abi"458version = "0.3.3"459source = "registry+https://github.com/rust-lang/crates.io-index"460checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"461
3 unmodified lines
465dependencies = [466 "anyhow",467 "approx",468 "assert_cmd",489 "atty",469 "clap",470 "clap_complete",471 "colored",472 "csv",
40 unmodified lines
513version = "0.4.9"514source = "registry+https://github.com/rust-lang/crates.io-index"515checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"516dependencies = [538 "hermit-abi 0.3.3",517 "hermit-abi",518 "rustix",519 "windows-sys 0.48.0",520]521
886 unmodified lines
modified:Cargo.toml-2 removed