remote server: Do not spawn server when proxy reconnects (#18864)
This ensures that we only ever reconnect to a running server and not spawn a new server with no state. This avoids the problem of the server process crashing, `proxy` reconnecting, starting a new server, and the user getting errors like "unknown buffer id: ...". Release Notes: - N/A --------- Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
This commit is contained in:
parent
dbf986d37a
commit
c674d73734
7 changed files with 248 additions and 91 deletions
|
@ -24,6 +24,8 @@ enum Commands {
|
|||
stdout_socket: PathBuf,
|
||||
},
|
||||
Proxy {
|
||||
#[arg(long)]
|
||||
reconnect: bool,
|
||||
#[arg(long)]
|
||||
identifier: String,
|
||||
},
|
||||
|
@ -37,6 +39,7 @@ fn main() {
|
|||
|
||||
#[cfg(not(windows))]
|
||||
fn main() -> Result<()> {
|
||||
use remote::proxy::ProxyLaunchError;
|
||||
use remote_server::unix::{execute_proxy, execute_run, init};
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
@ -51,9 +54,20 @@ fn main() -> Result<()> {
|
|||
init(Some(log_file))?;
|
||||
execute_run(pid_file, stdin_socket, stdout_socket)
|
||||
}
|
||||
Some(Commands::Proxy { identifier }) => {
|
||||
Some(Commands::Proxy {
|
||||
identifier,
|
||||
reconnect,
|
||||
}) => {
|
||||
init(None)?;
|
||||
execute_proxy(identifier)
|
||||
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"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue