From 9326d61c44738e8cc8147eff6f55851de51b7c0f Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Mon, 26 Jan 2026 14:15:33 -0500 Subject: [PATCH] remote_server: Avoid panic when writing to stderr (#47683) Closes ZED-4JM Release Notes: - N/A --- crates/remote_server/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/remote_server/src/main.rs b/crates/remote_server/src/main.rs index 5ca01c872e23b09e4dbbac2cb39645e9f5cb638f..66ffcc1631786a422de06d7aa2727b342eaa275c 100644 --- a/crates/remote_server/src/main.rs +++ b/crates/remote_server/src/main.rs @@ -1,5 +1,6 @@ use clap::Parser; use remote_server::Commands; +use std::io::Write as _; use std::path::PathBuf; #[derive(Parser)] @@ -45,7 +46,7 @@ fn main() -> anyhow::Result<()> { if let Err(e) = &res && let Some(e) = e.downcast_ref::() { - eprintln!("{e:#}"); + std::io::stderr().write_fmt(format_args!("{e:#}\n")).ok(); // It is important for us to report the proxy spawn exit code here // instead of the generic 1 that result returns // The client reads the exit code to determine if the server process has died when trying to reconnect @@ -54,7 +55,9 @@ fn main() -> anyhow::Result<()> { } res } else { - eprintln!("usage: remote "); + std::io::stderr() + .write_all(b"usage: remote \n") + .ok(); std::process::exit(1); } }