From 77994cab6b8f028031b95d263ea38cad3fc2bbab Mon Sep 17 00:00:00 2001 From: zhixian Date: Thu, 19 Feb 2026 11:47:26 +0900 Subject: [PATCH] fix: gate SSH agent auth behind #[cfg(unix)] for Windows compat AgentClient::connect_env() uses Unix domain sockets and is unavailable on Windows. Add a #[cfg(not(unix))] stub that returns an error message. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- src-tauri/src/ssh.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src-tauri/src/ssh.rs b/src-tauri/src/ssh.rs index 9d876cd..a0f5463 100644 --- a/src-tauri/src/ssh.rs +++ b/src-tauri/src/ssh.rs @@ -203,6 +203,8 @@ impl SshConnectionPool { } /// Try all keys offered by the ssh-agent until one succeeds. + /// Only available on Unix (SSH agent uses a Unix domain socket). + #[cfg(unix)] async fn authenticate_with_agent( &self, session: &mut client::Handle, @@ -240,6 +242,15 @@ impl SshConnectionPool { Ok(false) } + #[cfg(not(unix))] + async fn authenticate_with_agent( + &self, + _session: &mut client::Handle, + _username: &str, + ) -> Result { + Err("SSH agent forwarding is not supported on Windows".into()) + } + // -- resolve_home ----------------------------------------------------- /// Run `echo $HOME` over a fresh channel to discover the remote home dir.