Wallet command exit status on error
@@ -659,13 +659,12 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
}
// Handle single-use (command line) owner commands
- {
let wallet = Arc::new(Mutex::new(instantiate_wallet(
wallet_config.clone(),
passphrase,
use_db,
)));
- let _res = wallet::controller::owner_single_use(wallet, |api| {
+ let res = wallet::controller::owner_single_use(wallet, |api| {
match wallet_args.subcommand() {
("send", Some(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"),
}
});
- }
// we need to give log output a chance to catch up before exiting
thread::sleep(Duration::from_millis(100));
+
+ if res.is_err() {
+ exit(1);
+ }
}
