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: Fix wsl interop detection failing on some setups (#49708)

Lukas Wirthbe6f27cb8e74
diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rs
index 69619f13c2c..2eb2aea59ab 100644
--- a/crates/remote/src/transport/wsl.rs
+++ b/crates/remote/src/transport/wsl.rs
@@ -132,11 +132,17 @@ impl WslRemoteConnection {
}
async fn detect_has_wsl_interop(&self) -> Result<bool> {
- Ok(self
+ let interop = match self
.run_wsl_command_with_output("cat", &["/proc/sys/fs/binfmt_misc/WSLInterop"])
.await
- .inspect_err(|err| log::error!("Failed to detect wsl interop: {err}"))?
- .contains("enabled"))
+ {
+ Ok(interop) => interop,
+ Err(err) => self
+ .run_wsl_command_with_output("cat", &["/proc/sys/fs/binfmt_misc/WSLInterop-late"])
+ .await
+ .inspect_err(|err2| log::error!("Failed to detect wsl interop: {err}; {err2}"))?,
+ };
+ Ok(interop.contains("enabled"))
}
async fn windows_path_to_wsl_path(&self, source: &Path) -> Result<String> {
diff --git a/crates/remote_server/src/server.rs b/crates/remote_server/src/server.rs
index 12af7f95492..6f0cf300330 100644
--- a/crates/remote_server/src/server.rs
+++ b/crates/remote_server/src/server.rs
@@ -514,7 +514,7 @@ pub fn execute_run(
let is_wsl_interop = if cfg!(target_os = "linux") {
// See: https://learn.microsoft.com/en-us/windows/wsl/filesystems#disable-interoperability
- matches!(std::fs::read_to_string("/proc/sys/fs/binfmt_misc/WSLInterop"), Ok(s) if s.contains("enabled"))
+ matches!(std::fs::read_to_string("/proc/sys/fs/binfmt_misc/WSLInterop").or_else(|_| std::fs::read_to_string("/proc/sys/fs/binfmt_misc/WSLInterop-late")), Ok(s) if s.contains("enabled"))
} else {
false
};