mirror of
https://github.com/wez/wezterm.git
synced 2024-09-20 19:27:22 +03:00
windows: fix .ssh/known_hosts path
This commit is contained in:
parent
dde589af49
commit
9d0209d9a5
@ -281,7 +281,11 @@ impl Reconnectable {
|
||||
sess.handshake(tcp)?;
|
||||
|
||||
if let Ok(mut known_hosts) = sess.known_hosts() {
|
||||
let file = Path::new(&std::env::var("HOME").unwrap()).join(".ssh/known_hosts");
|
||||
let varname = if cfg!(windows) { "USERPROFILE" } else { "HOME" };
|
||||
let var = std::env::var_os(varname).ok_or_else(|| {
|
||||
failure::format_err!("environment variable {} is missing", varname)
|
||||
})?;
|
||||
let file = Path::new(&var).join(".ssh/known_hosts");
|
||||
if file.exists() {
|
||||
known_hosts
|
||||
.read_file(&file, ssh2::KnownHostFileKind::OpenSSH)
|
||||
|
Loading…
Reference in New Issue
Block a user