fix(windows-build): ssh-agent err when building on windows
This commit is contained in:
1 parent
759cab9088
commit
c7c71850d4
4 files changed
+12
No files matched your search
Generated
+1
@@ -1906,6 +1906,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"mongodb",
|
"mongodb",
|
||||||
"mysql_async",
|
"mysql_async",
|
||||||
|
"pageant",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"portpicker",
|
"portpicker",
|
||||||
"rayon",
|
"rayon",
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ futures = "0.3"
|
|||||||
iana-time-zone = "0.1"
|
iana-time-zone = "0.1"
|
||||||
mongodb = "3.2.5"
|
mongodb = "3.2.5"
|
||||||
russh = "0.60"
|
russh = "0.60"
|
||||||
|
pageant = "0.2"
|
||||||
portpicker = "0.1.1"
|
portpicker = "0.1.1"
|
||||||
csv = "1"
|
csv = "1"
|
||||||
calamine = "0.30.1"
|
calamine = "0.30.1"
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ async fn try_authenticate_with_agent(
|
|||||||
ssh_user: &str,
|
ssh_user: &str,
|
||||||
connect_timeout: &Duration,
|
connect_timeout: &Duration,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
#[cfg(unix)]
|
||||||
let mut agent = match AgentClient::connect_env().await {
|
let mut agent = match AgentClient::connect_env().await {
|
||||||
Ok(a) => a,
|
Ok(a) => a,
|
||||||
Err(e) => {
|
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 {
|
let identities = match agent.request_identities().await {
|
||||||
Ok(ids) if ids.is_empty() => {
|
Ok(ids) if ids.is_empty() => {
|
||||||
return Err("No SSH password or key provided, and ssh-agent has no identities".to_string());
|
return Err("No SSH password or key provided, and ssh-agent has no identities".to_string());
|
||||||
|
|||||||
@@ -433,6 +433,7 @@ fn spawn_plugin_child(plugin: &InstalledPlugin, env: &PluginRuntimeEnv) -> Resul
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
|
#[allow(unused_imports)]
|
||||||
use std::os::windows::process::CommandExt;
|
use std::os::windows::process::CommandExt;
|
||||||
command.creation_flags(CREATE_NO_WINDOW);
|
command.creation_flags(CREATE_NO_WINDOW);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user