use anyhow for remote_server main return.
this improve the report when an error occurs
This commit is contained in:
parent
896a35f7be
commit
b6fb9b10cf
1 changed files with 7 additions and 9 deletions
|
@ -50,7 +50,8 @@ fn main() {
|
|||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn main() {
|
||||
fn main() -> anyhow::Result<()> {
|
||||
use anyhow::Context;
|
||||
use release_channel::{RELEASE_CHANNEL, ReleaseChannel};
|
||||
use remote::proxy::ProxyLaunchError;
|
||||
use remote_server::unix::{execute_proxy, execute_run};
|
||||
|
@ -59,20 +60,20 @@ fn main() {
|
|||
|
||||
if let Some(socket_path) = &cli.askpass {
|
||||
askpass::main(socket_path);
|
||||
return;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(socket) = &cli.crash_handler {
|
||||
crashes::crash_server(socket.as_path());
|
||||
return;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if cli.printenv {
|
||||
util::shell_env::print_env();
|
||||
return;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let result = match cli.command {
|
||||
match cli.command {
|
||||
Some(Commands::Run {
|
||||
log_file,
|
||||
pid_file,
|
||||
|
@ -117,9 +118,6 @@ fn main() {
|
|||
eprintln!("usage: remote <run|proxy|version>");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
if let Err(error) = result {
|
||||
log::error!("exiting due to error: {}", error);
|
||||
std::process::exit(1);
|
||||
}
|
||||
.context("exiting remote server due to error")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue