Skip to content

Commit

Permalink
Remove atty dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
micprog committed Jul 6, 2023
1 parent 53b86df commit 20cfa60
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 30 deletions.
32 changes: 6 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dirs = "5"
pathdiff = "0.2"
common-path = "1.0.0"
itertools = "0.11"
atty = "0.2"
is-terminal = "0.4"
tabwriter = "1.2.1"
indexmap = { version = "2", features = ["serde"] }
tempfile = "3.5"
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/fusesoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::path::PathBuf;

use clap::{value_parser, Arg, ArgAction, ArgMatches, Command};
use indexmap::{IndexMap, IndexSet};
use is_terminal::IsTerminal;
use itertools::Itertools;
use tokio::runtime::Runtime;
use walkdir::{DirEntry, WalkDir};
Expand Down Expand Up @@ -282,7 +283,7 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> {
}
println!("{}", msg);
// Let user resolve conflict if both stderr and stdin go to a TTY.
if atty::is(atty::Stream::Stderr) && atty::is(atty::Stream::Stdin) {
if std::io::stderr().is_terminal() && std::io::stdin().is_terminal() {
index = {
loop {
eprint!("Enter a number or hit enter to abort: ");
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ extern crate blake2;
extern crate clap;
extern crate dirs;
extern crate glob;
extern crate is_terminal;
extern crate itertools;
extern crate pathdiff;
extern crate semver;
extern crate tempfile;
Expand Down
5 changes: 3 additions & 2 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use tokio::runtime::Runtime;
extern crate itertools;
use self::itertools::Itertools;

extern crate atty;
extern crate is_terminal;
use is_terminal::IsTerminal;

use std::io::{self, Write};

Expand Down Expand Up @@ -502,7 +503,7 @@ impl<'ctx> DependencyResolver<'ctx> {
}
cons = cons.into_iter().unique().collect();
// Let user resolve conflict if both stderr and stdin go to a TTY.
if atty::is(atty::Stream::Stderr) && atty::is(atty::Stream::Stdin) {
if std::io::stderr().is_terminal() && std::io::stdin().is_terminal() {
let decision = if let Some(d) = self.decisions.get(name) {
d.clone()
} else {
Expand Down

0 comments on commit 20cfa60

Please sign in to comment.