Skip to content

Commit e582f8a

Browse files
authored
Switch from atty to is-terminal. (#183)
The atty crate doesn't support operating on arbitrary streams, and uses a `Stream` enum which requires it to access stdio streams implicitly. Begin migrating to a new is-terminal crate, which has an API that takes an `AsFilelike` argument.
1 parent f439dcd commit e582f8a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ libc = { version = "0.2.111", features = ["extra_traits"] }
4646
winapi = { version = "0.3.9", features = ["ws2ipdef", "ws2tcpip"] }
4747

4848
[dev-dependencies]
49-
atty = "0.2.14"
49+
is-terminal = "0.0.0"
5050
tempfile = "3.2.0"
5151
libc = "0.2.106"
5252
serial_test = "0.5"

tests/io/isatty.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use is_terminal::IsTerminal;
12
use rustix::io::isatty;
23
use tempfile::{tempdir, TempDir};
34

@@ -24,8 +25,8 @@ fn stdout_stderr_terminals() {
2425
{
2526
return;
2627
}
27-
assert_eq!(isatty(&std::io::stdout()), atty::is(atty::Stream::Stdout));
28-
assert_eq!(isatty(&std::io::stderr()), atty::is(atty::Stream::Stderr));
28+
assert_eq!(isatty(&std::io::stdout()), std::io::stdout().is_terminal());
29+
assert_eq!(isatty(&std::io::stderr()), std::io::stderr().is_terminal());
2930
}
3031

3132
#[test]

0 commit comments

Comments
 (0)