Skip to content

Commit 9104e75

Browse files
chore: replace atty with is-terminal (#59)
atty can potentially segfault on windows: https://rustsec.org/advisories/RUSTSEC-2021-0145.html
1 parent 292d33e commit 9104e75

File tree

3 files changed

+142
-13
lines changed

3 files changed

+142
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ readme = "README.md"
1212
tracing-core = "0.1"
1313
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry", "fmt", "std"] }
1414
nu-ansi-term = "0.46.0"
15-
atty = "0.2"
15+
is-terminal = "0.4.7"
1616
tracing-log = { version = "0.1", optional = true }
1717
time = { version = "0.3.20", optional = true, features = ["formatting", "local-offset"] }
1818

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub mod time;
44
use crate::time::FormatTime;
55
use format::{Buffers, ColorLevel, Config, FmtEvent, SpanMode};
66

7+
use is_terminal::IsTerminal;
78
use nu_ansi_term::{Color, Style};
89
use std::{
910
fmt::{self, Write as _},
@@ -65,7 +66,7 @@ impl Default for HierarchicalLayer {
6566

6667
impl HierarchicalLayer<fn() -> io::Stderr> {
6768
pub fn new(indent_amount: usize) -> Self {
68-
let ansi = atty::is(atty::Stream::Stderr);
69+
let ansi = io::stderr().is_terminal();
6970
let config = Config {
7071
ansi,
7172
indent_amount,

test_dependencies/Cargo.lock

Lines changed: 139 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)