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 <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
zhixian
2026-02-19 11:47:26 +09:00
parent 9717a64310
commit 77994cab6b

View File

@@ -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<SshHandler>,
@@ -240,6 +242,15 @@ impl SshConnectionPool {
Ok(false)
}
#[cfg(not(unix))]
async fn authenticate_with_agent(
&self,
_session: &mut client::Handle<SshHandler>,
_username: &str,
) -> Result<bool, String> {
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.