windows: Fix ssh reporting wrong password even it's actually correct (#38263)
Closes #34393 Currently, we’re using `zed.exe --askpass` kind of like an `nc` substitute, it prints out the SSH password to stdout with something like `println!("user-pwd")`. `ssh.exe` then reads the password from stdout so it can establish the connection. The problem is that in release builds we set `subsystem=windows` to avoid Windows spawning a black console window by default. The side effect is that `zed.exe` no longer has a stdout, so `ssh.exe` can’t read the password. Through testing, I confirmed that neither allocating a new console for `zed.exe` nor attaching it to the parent process’s stdout resolves the issue. As a result, this PR updates the implementation to use `cli.exe --askpass` instead. TODO: - [ ] Check that the `cli` path is correct on macOS - [ ] Check that the `cli` path is correct on Linux Release Notes: - N/A --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
@@ -116,6 +116,11 @@ struct Args {
|
||||
))]
|
||||
#[arg(long)]
|
||||
uninstall: bool,
|
||||
|
||||
/// Used for SSH/Git password authentication, to remove the need for netcat as a dependency,
|
||||
/// by having Zed act like netcat communicating over a Unix socket.
|
||||
#[arg(long, hide = true)]
|
||||
askpass: Option<String>,
|
||||
}
|
||||
|
||||
fn parse_path_with_position(argument_str: &str) -> anyhow::Result<String> {
|
||||
@@ -203,6 +208,12 @@ fn main() -> Result<()> {
|
||||
}
|
||||
let args = Args::parse();
|
||||
|
||||
// `zed --askpass` Makes zed operate in nc/netcat mode for use with askpass
|
||||
if let Some(socket) = &args.askpass {
|
||||
askpass::main(socket);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Set custom data directory before any path operations
|
||||
let user_data_dir = args.user_data_dir.clone();
|
||||
if let Some(dir) = &user_data_dir {
|
||||
|
||||
Reference in New Issue
Block a user