Allow Ctrl-C when querying balances (#27314)
This commit is contained in:
parent
326f43d644
commit
62c5679557
|
@ -833,7 +833,11 @@ fn check_payer_balances(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_balances(client: &RpcClient, args: &BalancesArgs) -> Result<(), Error> {
|
pub fn process_balances(
|
||||||
|
client: &RpcClient,
|
||||||
|
args: &BalancesArgs,
|
||||||
|
exit: Arc<AtomicBool>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
let allocations: Vec<Allocation> =
|
let allocations: Vec<Allocation> =
|
||||||
read_allocations(&args.input_csv, None, false, args.spl_token_args.is_some())?;
|
read_allocations(&args.input_csv, None, false, args.spl_token_args.is_some())?;
|
||||||
let allocations = merge_allocations(&allocations);
|
let allocations = merge_allocations(&allocations);
|
||||||
|
@ -855,6 +859,10 @@ pub fn process_balances(client: &RpcClient, args: &BalancesArgs) -> Result<(), E
|
||||||
);
|
);
|
||||||
|
|
||||||
for allocation in &allocations {
|
for allocation in &allocations {
|
||||||
|
if exit.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::ExitSignal);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(spl_token_args) = &args.spl_token_args {
|
if let Some(spl_token_args) = &args.spl_token_args {
|
||||||
print_token_balances(client, allocation, spl_token_args)?;
|
print_token_balances(client, allocation, spl_token_args)?;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -44,7 +44,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
}
|
}
|
||||||
Command::Balances(mut args) => {
|
Command::Balances(mut args) => {
|
||||||
spl_token::update_decimals(&client, &mut args.spl_token_args)?;
|
spl_token::update_decimals(&client, &mut args.spl_token_args)?;
|
||||||
commands::process_balances(&client, &args)?;
|
commands::process_balances(&client, &args, exit)?;
|
||||||
}
|
}
|
||||||
Command::TransactionLog(args) => {
|
Command::TransactionLog(args) => {
|
||||||
commands::process_transaction_log(&args)?;
|
commands::process_transaction_log(&args)?;
|
||||||
|
|
Loading…
Reference in New Issue