List diaries only if output is not a pipe
Beforehand, this command: imag diary -d foo list | cat listed each entry twice because the reporting feature of libimagrt forwarded the list to stdout and the normal output was written to stderr. With this patch, we get the output only once in this case. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
d53e306459
commit
03fec5f4db
1 changed files with 3 additions and 1 deletions
|
@ -57,7 +57,9 @@ pub fn list(rt: &Runtime) {
|
||||||
.for_each(|id| {
|
.for_each(|id| {
|
||||||
let _ = rt.report_touched(&id).unwrap_or_exit();
|
let _ = rt.report_touched(&id).unwrap_or_exit();
|
||||||
|
|
||||||
writeln!(rt.stdout(), "{}", id).to_exit_code().unwrap_or_exit()
|
if !rt.output_is_pipe() {
|
||||||
|
writeln!(rt.stdout(), "{}", id).to_exit_code().unwrap_or_exit()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue