Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

remote_server: Avoid panic when writing to stderr (#47683)

Cole Miller9326d61c4473
diff --git a/crates/remote_server/src/main.rs b/crates/remote_server/src/main.rs
index 5ca01c872e2..66ffcc16317 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::<ExecuteProxyError>()
{
- 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 <run|proxy|version>");
+ std::io::stderr()
+ .write_all(b"usage: remote <run|proxy|version>\n")
+ .ok();
std::process::exit(1);
}
}