From 74810d9ccc5b41eb41f3d8121ccd9c02634a1455 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 31 Aug 2019 13:44:19 +0200 Subject: [PATCH] Fix: Print processed IDs if output is not a pipe. Signed-off-by: Matthias Beyer --- bin/core/imag-header/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/core/imag-header/src/main.rs b/bin/core/imag-header/src/main.rs index 6a9ce305..b6affe6d 100644 --- a/bin/core/imag-header/src/main.rs +++ b/bin/core/imag-header/src/main.rs @@ -151,6 +151,7 @@ fn has<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) { debug!("Processing headers: has value"); let header_path = get_header_path(mtch, "header-value-path"); + let mut output = rt.stdout(); iter.for_each(|entry| { trace!("Processing headers: working on {:?}", entry.get_location()); @@ -161,6 +162,9 @@ fn has<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) .is_some() { rt.report_touched(entry.get_location()).unwrap_or_exit(); + if !rt.output_is_pipe() { + writeln!(output, "{}", entry.get_location()).to_exit_code().unwrap_or_exit(); + } } }) } @@ -170,6 +174,7 @@ fn hasnt<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) { debug!("Processing headers: hasnt value"); let header_path = get_header_path(mtch, "header-value-path"); + let mut output = rt.stdout(); iter.for_each(|entry| { trace!("Processing headers: working on {:?}", entry.get_location()); @@ -179,6 +184,9 @@ fn hasnt<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) .map_err_trace_exit_unwrap() .is_none() { rt.report_touched(entry.get_location()).unwrap_or_exit(); + if !rt.output_is_pipe() { + writeln!(output, "{}", entry.get_location()).to_exit_code().unwrap_or_exit(); + } } }) }