remote: Fix wsl interop detection failing on some setups (#49708)

Closes https://github.com/zed-industries/zed/issues/49697

Release Notes:

- Fixed interop detection on WSL not working on newer setups
This commit is contained in:
Lukas Wirth 2026-02-20 12:51:49 +01:00 committed by GitHub
parent 10a7987837
commit be6f27cb8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -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> {

View file

@ -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
};