From b91f6bcbff4d03ad055aa14140c5ad4b8474b9d8 Mon Sep 17 00:00:00 2001 From: rleungx Date: Thu, 19 Apr 2018 22:06:19 +0800 Subject: [PATCH] report parse errors to stderr --- src/bin/client-demo.rs | 6 +++++- src/bin/testnode.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/client-demo.rs b/src/bin/client-demo.rs index 0829c15e2f..50b2dd0640 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -12,6 +12,7 @@ use solana::transaction::Transaction; use std::env; use std::io::stdin; use std::net::UdpSocket; +use std::process::exit; use std::thread::sleep; use std::time::{Duration, Instant}; @@ -27,7 +28,10 @@ fn main() { let args: Vec = env::args().collect(); let matches = match opts.parse(&args[1..]) { Ok(m) => m, - Err(f) => panic!(f.to_string()), + Err(e) => { + eprintln!("{}", e); + exit(1); + } }; if matches.opt_present("s") { diff --git a/src/bin/testnode.rs b/src/bin/testnode.rs index 3e0ac84266..068a4c839b 100644 --- a/src/bin/testnode.rs +++ b/src/bin/testnode.rs @@ -11,6 +11,7 @@ use solana::event::Event; use solana::historian::Historian; use std::env; use std::io::{self, stdout, BufRead}; +use std::process::exit; use std::sync::atomic::AtomicBool; use std::sync::{Arc, Mutex}; @@ -22,7 +23,10 @@ fn main() { let args: Vec = env::args().collect(); let matches = match opts.parse(&args[1..]) { Ok(m) => m, - Err(f) => panic!(f.to_string()), + Err(e) => { + eprintln!("{}", e); + exit(1); + } }; if matches.opt_present("p") { port = matches.opt_str("p").unwrap().parse().expect("port");