Wallet command exit status on error (#1253)

This commit is contained in:
Ignotus Peverell 2018-07-12 20:05:43 +01:00 committed by GitHub
parent bdfd5405c0
commit 12a2fc4f5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -659,13 +659,12 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
} }
// Handle single-use (command line) owner commands // Handle single-use (command line) owner commands
{
let wallet = Arc::new(Mutex::new(instantiate_wallet( let wallet = Arc::new(Mutex::new(instantiate_wallet(
wallet_config.clone(), wallet_config.clone(),
passphrase, passphrase,
use_db, use_db,
))); )));
let _res = wallet::controller::owner_single_use(wallet, |api| { let res = wallet::controller::owner_single_use(wallet, |api| {
match wallet_args.subcommand() { match wallet_args.subcommand() {
("send", Some(send_args)) => { ("send", Some(send_args)) => {
let amount = send_args let amount = send_args
@ -795,7 +794,10 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
_ => panic!("Unknown wallet command, use 'grin help wallet' for details"), _ => panic!("Unknown wallet command, use 'grin help wallet' for details"),
} }
}); });
}
// we need to give log output a chance to catch up before exiting // we need to give log output a chance to catch up before exiting
thread::sleep(Duration::from_millis(100)); thread::sleep(Duration::from_millis(100));
if res.is_err() {
exit(1);
}
} }