Show error message if ssh-agent failed to start
This commit is contained in:
parent
ebb78c3628
commit
826bc237a3
@ -284,11 +284,14 @@ fn start_ssh_agent() -> Result<(), String> {
|
||||
.stdout(Stdio::piped())
|
||||
.output()
|
||||
.map_err(|e| format!("failed to start ssh agent: {e}"))?;
|
||||
let agent_output = String::from_utf8_lossy(&agent_output.stdout);
|
||||
let agent_stdout = String::from_utf8_lossy(&agent_output.stdout);
|
||||
if !agent_output.status.success() {
|
||||
return Err("failed to start ssh agent; maybe try to run ssh-agent manually?".to_string());
|
||||
}
|
||||
|
||||
//set the env vars from the agent
|
||||
static ENV_VAR_REGEX: Lazy<Regex> = lazy_regex!("(.+?)=(.+?);");
|
||||
for capture in ENV_VAR_REGEX.captures_iter(&agent_output) {
|
||||
for capture in ENV_VAR_REGEX.captures_iter(&agent_stdout) {
|
||||
let (_, [env_var, value]) = capture.extract();
|
||||
env::set_var(env_var, value);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user