From e3f86318c635f6b96003781e2a584b09d5a0d9c7 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 24 Sep 2016 19:00:12 -0400 Subject: [PATCH] Ignore errors resulting from printing to stdout. Fixes https://github.com/BurntSushi/ripgrep/issues/22 --- src/dopt.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dopt.rs b/src/dopt.rs index 50f849d..12e80c4 100644 --- a/src/dopt.rs +++ b/src/dopt.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use std::error::Error as StdError; use std::fmt::{self, Debug}; +use std::io::{self, Write}; use std::str::FromStr; use regex::{Captures, Regex}; @@ -107,7 +108,7 @@ impl Error { werr!("{}\n", self); ::std::process::exit(1) } else { - println!("{}", self); + let _ = writeln!(&mut io::stdout(), "{}", self); ::std::process::exit(0) } }