[PATCH 1 of 6] rust-chg: suppress panic while writing chg error to stderr

Yuya Nishihara yuya at tcha.org
Sun Oct 14 08:18:18 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1538913351 -32400
#      Sun Oct 07 20:55:51 2018 +0900
# Node ID 4a4f95df41de64fb472cb131d5ff4eeb8e846870
# Parent  3b275f5497771d8a71336273a77575dbf4882798
rust-chg: suppress panic while writing chg error to stderr

Otherwise "chg >/dev/full 2>&1" would exit with 101. Spotted by test-basic.t.

diff --git a/rust/chg/src/main.rs b/rust/chg/src/main.rs
--- a/rust/chg/src/main.rs
+++ b/rust/chg/src/main.rs
@@ -20,7 +20,7 @@ use tokio_hglib::UnixClient;
 
 fn main() {
     let code = run().unwrap_or_else(|err| {
-        eprintln!("chg: abort: {}", err);
+        writeln!(io::stderr(), "chg: abort: {}", err).unwrap_or(());
         255
     });
     process::exit(code);


More information about the Mercurial-devel mailing list