fix(windows-build): ssh-agent err when building on windows

This commit is contained in:
Doracoin authored and GitHub committed 2026-06-11 17:29:40 +08:00
1 parent 759cab9088
commit c7c71850d4
4 files changed
+12

No files matched your search

+9
View File
@@ -112,6 +112,7 @@ async fn try_authenticate_with_agent(
ssh_user: &str,
connect_timeout: &Duration,
) -> Result<(), String> {
#[cfg(unix)]
let mut agent = match AgentClient::connect_env().await {
Ok(a) => a,
Err(e) => {
@@ -119,6 +120,14 @@ async fn try_authenticate_with_agent(
}
};
#[cfg(windows)]
let mut agent = {
let stream = pageant::PageantStream::new()
.await
.map_err(|e| format!("No SSH password or key provided, and ssh-agent (Pageant) is unavailable: {e}"))?;
AgentClient::connect(stream)
};
let identities = match agent.request_identities().await {
Ok(ids) if ids.is_empty() => {
return Err("No SSH password or key provided, and ssh-agent has no identities".to_string());