ssh remote: Stream stderr from server via proxy to client (#19073)

Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-10-11 17:11:20 +02:00 committed by GitHub
parent d976c5f1b6
commit c21f26c419
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 220 additions and 97 deletions

View file

@ -22,6 +22,8 @@ enum Commands {
stdin_socket: PathBuf,
#[arg(long)]
stdout_socket: PathBuf,
#[arg(long)]
stderr_socket: PathBuf,
},
Proxy {
#[arg(long)]
@ -40,7 +42,7 @@ fn main() {
#[cfg(not(windows))]
fn main() -> Result<()> {
use remote::proxy::ProxyLaunchError;
use remote_server::unix::{execute_proxy, execute_run, init};
use remote_server::unix::{execute_proxy, execute_run};
let cli = Cli::parse();
@ -50,25 +52,26 @@ fn main() -> Result<()> {
pid_file,
stdin_socket,
stdout_socket,
}) => {
init(Some(log_file))?;
execute_run(pid_file, stdin_socket, stdout_socket)
}
stderr_socket,
}) => execute_run(
log_file,
pid_file,
stdin_socket,
stdout_socket,
stderr_socket,
),
Some(Commands::Proxy {
identifier,
reconnect,
}) => {
init(None)?;
match execute_proxy(identifier, reconnect) {
Ok(_) => Ok(()),
Err(err) => {
if let Some(err) = err.downcast_ref::<ProxyLaunchError>() {
std::process::exit(err.to_exit_code());
}
Err(err)
}) => match execute_proxy(identifier, reconnect) {
Ok(_) => Ok(()),
Err(err) => {
if let Some(err) = err.downcast_ref::<ProxyLaunchError>() {
std::process::exit(err.to_exit_code());
}
Err(err)
}
}
},
Some(Commands::Version) => {
eprintln!("{}", env!("ZED_PKG_VERSION"));
Ok(())