Skip to content

Commit bb0065d

Browse files
authored
Merge pull request #2859 from fermyon/remove-atty
2 parents a478da4 + 4bc0bf6 commit bb0065d

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/terminal/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ authors = { workspace = true }
55
edition = { workspace = true }
66

77
[dependencies]
8-
atty = "0.2"
98
termcolor = "1"

crates/terminal/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This library is used by Spin to print out messages in an appropriate format
44
//! that is easy for users to read. This is not meant as a general purpose library.
55
6-
use std::sync::OnceLock;
6+
use std::{io::IsTerminal, sync::OnceLock};
77
use termcolor::{ColorSpec, StandardStream, StandardStreamLock, WriteColor};
88

99
static COLOR_OUT: OnceLock<StandardStream> = OnceLock::new();
@@ -16,14 +16,14 @@ impl ColorText {
1616
/// Create a `ColorText` tied to stdout
1717
pub fn stdout(spec: ColorSpec) -> ColorText {
1818
let stream =
19-
COLOR_OUT.get_or_init(|| StandardStream::stdout(color_choice(atty::Stream::Stdout)));
19+
COLOR_OUT.get_or_init(|| StandardStream::stdout(color_choice(std::io::stdout())));
2020
set_color(stream, spec)
2121
}
2222

2323
/// Create a `ColorText` tied to stderr
2424
pub fn stderr(spec: ColorSpec) -> ColorText {
2525
let stream =
26-
COLOR_ERR.get_or_init(|| StandardStream::stderr(color_choice(atty::Stream::Stderr)));
26+
COLOR_ERR.get_or_init(|| StandardStream::stderr(color_choice(std::io::stderr())));
2727
set_color(stream, spec)
2828
}
2929
}
@@ -64,8 +64,8 @@ fn set_color(stream: &'static StandardStream, spec: ColorSpec) -> ColorText {
6464
ColorText(lock)
6565
}
6666

67-
fn color_choice(stream: atty::Stream) -> termcolor::ColorChoice {
68-
if atty::is(stream) {
67+
fn color_choice(stream: impl IsTerminal) -> termcolor::ColorChoice {
68+
if stream.is_terminal() {
6969
termcolor::ColorChoice::Auto
7070
} else {
7171
termcolor::ColorChoice::Never

0 commit comments

Comments
 (0)