ssh: Use openbsd nc on macOS (#20751)
Co-authored-by: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
parent
4c8c6c08fe
commit
6e296eb4b6
3 changed files with 15 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -9986,6 +9986,7 @@ dependencies = [
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"util",
|
"util",
|
||||||
|
"which 6.0.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -38,6 +38,7 @@ tempfile.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
release_channel.workspace = true
|
release_channel.workspace = true
|
||||||
|
which.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
gpui = { workspace = true, features = ["test-support"] }
|
gpui = { workspace = true, features = ["test-support"] }
|
||||||
|
|
|
@ -1428,9 +1428,21 @@ impl SshRemoteConnection {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
anyhow::ensure!(
|
||||||
|
which::which("nc").is_ok(),
|
||||||
|
"Cannot find nc, which is required to connect over ssh."
|
||||||
|
);
|
||||||
|
|
||||||
// Create an askpass script that communicates back to this process.
|
// Create an askpass script that communicates back to this process.
|
||||||
let askpass_script = format!(
|
let askpass_script = format!(
|
||||||
"{shebang}\n{print_args} | nc -U {askpass_socket} 2> /dev/null \n",
|
"{shebang}\n{print_args} | {nc} -U {askpass_socket} 2> /dev/null \n",
|
||||||
|
// on macOS `brew install netcat` provides the GNU netcat implementation
|
||||||
|
// which does not support -U.
|
||||||
|
nc = if cfg!(target_os = "macos") {
|
||||||
|
"/usr/bin/nc"
|
||||||
|
} else {
|
||||||
|
"nc"
|
||||||
|
},
|
||||||
askpass_socket = askpass_socket.display(),
|
askpass_socket = askpass_socket.display(),
|
||||||
print_args = "printf '%s\\0' \"$@\"",
|
print_args = "printf '%s\\0' \"$@\"",
|
||||||
shebang = "#!/bin/sh",
|
shebang = "#!/bin/sh",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue