@@ -11,7 +11,7 @@ use std::env::consts::ARCH;
11
11
use std:: env:: { remove_var, set_var, var} ;
12
12
use std:: fmt;
13
13
use std:: fs:: { remove_file, OpenOptions } ;
14
- use std:: io:: { stderr, stdin, stdout, BufRead } ;
14
+ use std:: io:: { stderr, stdin, stdout, BufRead , IsTerminal } ;
15
15
use std:: path:: { Path , PathBuf } ;
16
16
use std:: str:: FromStr ;
17
17
@@ -25,8 +25,6 @@ use anyhow::{anyhow, bail, ensure, Context, Error, Result};
25
25
use bitflags:: bitflags;
26
26
use cini:: { Callback , CallbackKind , Ini } ;
27
27
use globset:: { Glob , GlobSet , GlobSetBuilder } ;
28
- use nix:: unistd:: isatty;
29
- use std:: os:: unix:: io:: AsRawFd ;
30
28
use tr:: tr;
31
29
use url:: Url ;
32
30
@@ -106,12 +104,7 @@ pub struct Colors {
106
104
impl From < & str > for Colors {
107
105
fn from ( s : & str ) -> Self {
108
106
match s {
109
- "auto"
110
- if isatty ( stdout ( ) . as_raw_fd ( ) ) . unwrap_or ( false )
111
- && isatty ( stderr ( ) . as_raw_fd ( ) ) . unwrap_or ( false ) =>
112
- {
113
- Colors :: new ( )
114
- }
107
+ "auto" if stdout ( ) . is_terminal ( ) && stderr ( ) . is_terminal ( ) => Colors :: new ( ) ,
115
108
"always" => Colors :: new ( ) ,
116
109
_ => Colors :: default ( ) ,
117
110
}
0 commit comments