Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
remote: Reuse the known OS when reconnecting over SSH (#65024)
狐狸e4945b5d0990
diff --git a/crates/remote/src/remote_client.rs b/crates/remote/src/remote_client.rsindex 91eb5c5a2fe..c645a31d129 100644--- a/crates/remote/src/remote_client.rs+++ b/crates/remote/src/remote_client.rs@@ -385,7 +385,7 @@ pub async fn connect() -> Result<Arc<dyn RemoteConnection>> {cx.update(|cx| {cx.update_default_global(|pool: &mut ConnectionPool, cx| {- pool.connect(connection_options.clone(), delegate.clone(), cx)+ pool.connect(connection_options.clone(), None, delegate.clone(), cx)})}).await@@ -684,7 +684,12 @@ impl RemoteClient {let (remote_connection, io_task) = match async {let remote_connection = cx.update_global(|pool: &mut ConnectionPool, cx| {- pool.connect(connection_options, delegate.clone(), cx)+ pool.connect(+ connection_options,+ Some(remote_connection.remote_platform().os),+ delegate.clone(),+ cx,+ )}).await.map_err(|error| error.cloned())?;@@ -1231,6 +1236,7 @@ impl ConnectionPool {fn connect(&mut self,opts: RemoteConnectionOptions,+ known_os: Option<RemoteOs>,delegate: Arc<dyn RemoteClientDelegate>,cx: &mut App,) -> Shared<Task<Result<Arc<dyn RemoteConnection>, Arc<anyhow::Error>>>> {@@ -1270,7 +1276,7 @@ impl ConnectionPool {async move |cx| {let connection = match opts.clone() {RemoteConnectionOptions::Ssh(opts) => {- SshRemoteConnection::new(opts, delegate, cx)+ SshRemoteConnection::new(opts, known_os, delegate, cx).await.map(|connection| Arc::new(connection) as Arc<dyn RemoteConnection>)}diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rsindex c13e39b9582..5c9ab757162 100644--- a/crates/remote/src/transport/ssh.rs+++ b/crates/remote/src/transport/ssh.rs@@ -633,6 +633,7 @@ async fn find_existing_control_master(impl SshRemoteConnection {pub(crate) async fn new(connection_options: SshConnectionOptions,+ known_os: Option<RemoteOs>,delegate: Arc<dyn RemoteClientDelegate>,cx: &mut AsyncApp,) -> Result<Self> {@@ -788,7 +789,10 @@ impl SshRemoteConnection {(socket, Some(master_process))};- let is_windows = socket.probe_is_windows().await;+ let is_windows = match known_os {+ Some(os) => os.is_windows(),+ None => socket.probe_is_windows().await,+ };log::info!("Remote is windows: {}", is_windows);let ssh_shell = socket.shell(is_windows).await;