ssh remoting: Do not print error backtrace on non-zero exit (#19290)

Closes #ISSUE


Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-10-17 09:41:16 +02:00 committed by GitHub
parent 57369b5a54
commit 3216de7eb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,5 @@
#![cfg_attr(target_os = "windows", allow(unused, dead_code))] #![cfg_attr(target_os = "windows", allow(unused, dead_code))]
use anyhow::Result;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use std::path::PathBuf; use std::path::PathBuf;
@ -40,13 +39,13 @@ fn main() {
} }
#[cfg(not(windows))] #[cfg(not(windows))]
fn main() -> Result<()> { fn main() {
use remote::proxy::ProxyLaunchError; use remote::proxy::ProxyLaunchError;
use remote_server::unix::{execute_proxy, execute_run}; use remote_server::unix::{execute_proxy, execute_run};
let cli = Cli::parse(); let cli = Cli::parse();
match cli.command { let result = match cli.command {
Some(Commands::Run { Some(Commands::Run {
log_file, log_file,
pid_file, pid_file,
@ -74,11 +73,15 @@ fn main() -> Result<()> {
}, },
Some(Commands::Version) => { Some(Commands::Version) => {
eprintln!("{}", env!("ZED_PKG_VERSION")); eprintln!("{}", env!("ZED_PKG_VERSION"));
Ok(()) std::process::exit(0);
} }
None => { None => {
eprintln!("usage: remote <run|proxy|version>"); eprintln!("usage: remote <run|proxy|version>");
std::process::exit(1); std::process::exit(1);
} }
};
if let Err(error) = result {
log::error!("exiting due to error: {}", error);
std::process::exit(1);
} }
} }