diff --git a/src/bin/client-demo.rs b/src/bin/client-demo.rs index 0829c15e2f3a2e..a58f6a7ae71963 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -10,8 +10,9 @@ use solana::mint::Mint; use solana::signature::{KeyPair, KeyPairUtil}; use solana::transaction::Transaction; use std::env; -use std::io::stdin; +use std::io::{stderr, stdin, Write}; 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) => { + writeln!(stderr(), "{}", e).unwrap(); + exit(1); + } }; if matches.opt_present("s") { diff --git a/src/bin/testnode.rs b/src/bin/testnode.rs index 3e0ac842664e0c..c6b1b6d8927d90 100644 --- a/src/bin/testnode.rs +++ b/src/bin/testnode.rs @@ -10,7 +10,8 @@ use solana::entry::Entry; use solana::event::Event; use solana::historian::Historian; use std::env; -use std::io::{self, stdout, BufRead}; +use std::io::{self, stderr, stdout, BufRead, Write}; +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) => { + writeln!(stderr(), "{}", e).unwrap(); + exit(1); + } }; if matches.opt_present("p") { port = matches.opt_str("p").unwrap().parse().expect("port");