diff --git a/Cargo.lock b/Cargo.lock index 062ab4c..30c5112 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -701,7 +701,7 @@ dependencies = [ [[package]] name = "ngxav" -version = "0.6.1" +version = "0.6.2" dependencies = [ "atty", "chrono", diff --git a/Cargo.toml b/Cargo.toml index c1ce30e..177d2fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ workspace = { members = [ "tests","tests/obfuscate_access_log_ips"] } [package] name = "ngxav" -version = "0.6.1" +version = "0.6.2" edition = "2021" license = "MIT" description = "Search through NGINX logs with advanced filters and support for displaying analytics about your selected log entries" diff --git a/src/main.rs b/src/main.rs index 0f4d4bf..f5e048f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,8 @@ use atty::Stream; use clap::Parser; use rayon::prelude::*; use std::collections::HashMap; -use std::iter::FromIterator; +use std::io::IsTerminal; + use utils::keep_line::keep_line; use utils::parse_nginx_time_format::parse_nginx_time_format; use utils::read_folder::read_folder; @@ -32,6 +33,10 @@ fn read_line_by_line(filename: impl AsRef) -> io::Result Vec { let stdin = io::stdin(); + if std::io::stdin().is_terminal() { + return Vec::new(); + } + return stdin .lock() .lines()