1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 18:57:59 +03:00

wezterm-ssh: default to libssh2. mux: revise bootstrap_via_ssh

This commit revises the tls domain bootstrap via ssh code and
makes it work again from a windows client.
This commit is contained in:
Wez Furlong 2021-12-15 11:10:16 -07:00
parent f398f333cd
commit 8b58f28125
2 changed files with 20 additions and 19 deletions

View File

@ -727,24 +727,25 @@ impl Reconnectable {
let mut exec = smol::block_on(sess.exec(&cmd, None))
.with_context(|| format!("executing `{}` on remote host", cmd))?;
// stdout holds an encoded pdu
let mut buf = Vec::new();
exec.stdout
.read_to_end(&mut buf)
.context("reading tlscreds response to buffer")?;
log::debug!("waiting for command to finish");
let status = exec.child.wait()?;
if !status.success() {
anyhow::bail!("{} failed", cmd);
}
drop(exec.stdin);
// stderr is ideally empty
let mut err = String::new();
exec.stderr
.read_to_string(&mut err)
.context("reading tlscreds stderr")?;
if !err.is_empty() {
log::error!("remote: `{}` stderr -> `{}`", cmd, err);
}
let mut stderr = exec.stderr;
thread::spawn(move || {
// stderr is ideally empty
let mut err = String::new();
let _ = stderr.read_to_string(&mut err);
if !err.is_empty() {
log::error!("remote: `{}` stderr -> `{}`", cmd, err);
}
});
let creds = match Pdu::decode(buf.as_slice())
let creds = match Pdu::decode(exec.stdout)
.context("reading tlscreds response")?
.pdu
{

View File

@ -70,7 +70,7 @@ impl SessionInner {
.config
.get("wezterm_ssh_backend")
.map(|s| s.as_str())
.unwrap_or("ssh2");
.unwrap_or("libssh");
match backend {
"ssh2" => self.run_impl_ssh2(),
"libssh" => self.run_impl_libssh(),
@ -128,10 +128,10 @@ impl SessionInner {
let function = CStr::from_ptr(function).to_string_lossy().to_string();
let message = CStr::from_ptr(message).to_string_lossy().to_string();
/// The message typically has "function: message" prefixed, which
/// looks redundant when logged with the function prefix by the
/// logging crate.
/// Strip that off!
// The message typically has "function: message" prefixed, which
// looks redundant when logged with the function prefix by the
// logging crate.
// Strip that off!
let message = match message.strip_prefix(&format!("{}: ", function)) {
Some(m) => m,
None => &message,