remote: Add FreeBSD to RemoteOs enum and platform detection

Add FreeBSD as a recognized remote OS so the Zed client can connect
to FreeBSD hosts without requiring a uname wrapper workaround.

- Add RemoteOs::FreeBSD variant with "freebsd" identifier
- Add "FreeBSD" to parse_platform() uname parsing
- Add "unknown-freebsd" target triple mapping
- FreeBSD uses PathStyle::Posix (already covered by wildcard arms)
This commit is contained in:
G36maid 2026-05-01 14:11:51 +08:00
parent ac1fe538df
commit e722eaa4e4
2 changed files with 8 additions and 0 deletions

View file

@ -57,6 +57,7 @@ pub enum RemoteOs {
Linux,
MacOs,
Windows,
FreeBSD,
}
impl RemoteOs {
@ -65,6 +66,7 @@ impl RemoteOs {
RemoteOs::Linux => "linux",
RemoteOs::MacOs => "macos",
RemoteOs::Windows => "windows",
RemoteOs::FreeBSD => "freebsd",
}
}

View file

@ -32,6 +32,7 @@ fn parse_platform(output: &str) -> Result<RemotePlatform> {
let os = match os {
"Darwin" => RemoteOs::MacOs,
"Linux" => RemoteOs::Linux,
"FreeBSD" => RemoteOs::FreeBSD,
_ => anyhow::bail!(
"Prebuilt remote servers are not yet available for {os:?}. See https://zed.dev/docs/remote-development"
),
@ -244,6 +245,7 @@ async fn build_remote_server_from_source(
"unknown-linux-gnu"
},
RemoteOs::MacOs => "apple-darwin",
RemoteOs::FreeBSD => "unknown-freebsd",
RemoteOs::Windows if cfg!(windows) => "pc-windows-msvc",
RemoteOs::Windows => "pc-windows-gnu",
}
@ -444,6 +446,10 @@ mod tests {
assert!(parse_platform("Windows x86_64\n").is_err());
assert!(parse_platform("Linux armv7l\n").is_err());
let result = parse_platform("FreeBSD x86_64\n").unwrap();
assert_eq!(result.os, RemoteOs::FreeBSD);
assert_eq!(result.arch, RemoteArch::X86_64);
}
#[test]