2
0
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:
chris west 2020-01-11 18:47:51 -08:00
parent 37170c4ee2
commit 349b1c6ba6

View File

@ -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)