From 349b1c6ba6b97239a8ecf3986ef13d5dd956454a Mon Sep 17 00:00:00 2001 From: chris west Date: Sat, 11 Jan 2020 18:47:51 -0800 Subject: [PATCH] don't do TTY stuff in tests --- src/args.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/args.rs b/src/args.rs index 9fa0d1c..edb08c6 100644 --- a/src/args.rs +++ b/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>(args: &[T]) -> Result { 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)