Skip to content

Commit

Permalink
Remove atty dependency (fixes #719)
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Jul 6, 2024
1 parent 999eac0 commit 52c52f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions crates/rune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ emit = ["std", "codespan-reporting"]
bench = []
workspace = ["std", "toml", "semver", "relative-path", "serde-hashkey", "linked-hash-map"]
doc = ["std", "rust-embed", "handlebars", "pulldown-cmark", "syntect", "sha2", "base64", "rune-core/doc", "relative-path"]
cli = ["std", "emit", "doc", "bincode", "atty", "tracing-subscriber", "clap", "webbrowser", "capture-io", "disable-io", "languageserver", "fmt", "similar", "rand"]
cli = ["std", "emit", "doc", "bincode", "tracing-subscriber", "clap", "webbrowser", "capture-io", "disable-io", "languageserver", "fmt", "similar", "rand"]
languageserver = ["std", "lsp", "ropey", "percent-encoding", "url", "serde_json", "tokio", "workspace", "doc", "fmt"]
byte-code = ["alloc", "musli/storage"]
capture-io = ["alloc", "parking_lot"]
Expand All @@ -48,7 +48,6 @@ musli = { version = "0.0.121", default-features = false, features = ["alloc"] }
once_cell = { version = "1.18.0", default-features = false, features = ["critical-section"] }

anyhow = { version = "1.0.71", default-features = false, optional = true }
atty = { version = "0.2.14", optional = true }
bincode = { version = "1.3.3", optional = true }
clap = { version = "4.2.7", features = ["derive"], optional = true }
codespan-reporting = { version = "0.11.1", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/rune/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod visitor;
use rust_alloc::string::String;
use rust_alloc::vec::Vec;
use std::fmt;
use std::io::{self, Write};
use std::io::{self, IsTerminal, Write};
use std::path::{Path, PathBuf};

use crate::alloc;
Expand Down Expand Up @@ -200,7 +200,7 @@ impl<'a> Entry<'a> {
"always" => ColorChoice::Always,
"ansi" => ColorChoice::AlwaysAnsi,
"auto" => {
if atty::is(atty::Stream::Stdout) {
if std::io::stdin().is_terminal() {
ColorChoice::Auto
} else {
ColorChoice::Never
Expand Down

0 comments on commit 52c52f5

Please sign in to comment.