Skip to content

Commit

Permalink
Return non-zero status from snxctl in case of the network or connecti…
Browse files Browse the repository at this point in the history
…vity issues. Fixes #81
  • Loading branch information
ancwrd1 committed Feb 18, 2025
1 parent 674e9d1 commit 5972dc4
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions snxctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,22 @@ async fn main() -> anyhow::Result<()> {

let command = params.command.into();

match service_controller.command(command).await {
Ok(status) if command != ServiceCommand::Info => {
if let Some(since) = status.connected_since {
println!(
"{} since: {}",
if status.mfa.is_some() {
"MFA pending"
} else {
"Connected"
},
since
);
} else {
println!("Disconnected");
}
let status = service_controller.command(command).await?;

if command != ServiceCommand::Info {
if let Some(since) = status.connected_since {
println!(
"{} since: {}",
if status.mfa.is_some() {
"MFA pending"
} else {
"Connected"
},
since
);
} else {
println!("Disconnected");
}
Err(e) => println!("Error: {e}"),
_ => {}
}

Ok(())
Expand Down

0 comments on commit 5972dc4

Please sign in to comment.