mirror of
https://github.com/xvxx/phetch
synced 2024-11-05 00:00:58 +00:00
don't do TTY stuff in tests
This commit is contained in:
parent
37170c4ee2
commit
349b1c6ba6
11
src/args.rs
11
src/args.rs
@ -2,9 +2,11 @@ use crate::{
|
||||
config::{self, Config},
|
||||
ui::Mode,
|
||||
};
|
||||
use atty;
|
||||
use std::{error::Error, fmt, result::Result};
|
||||
|
||||
#[cfg(not(test))]
|
||||
use atty;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArgError {
|
||||
details: String,
|
||||
@ -167,8 +169,11 @@ pub fn parse<T: AsRef<str>>(args: &[T]) -> Result<Config, ArgError> {
|
||||
return Err(ArgError::new("can't set both --tor and --tls"));
|
||||
}
|
||||
|
||||
if !atty::is(atty::Stream::Stdout) {
|
||||
cfg.mode = Mode::NoTTY;
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
if !atty::is(atty::Stream::Stdout) {
|
||||
cfg.mode = Mode::NoTTY;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(cfg)
|
||||
|
Loading…
Reference in New Issue
Block a user