aboutsummaryrefslogtreecommitdiff
path: root/src/remote
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-09-07 19:33:11 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-09-07 19:33:11 +0300
commit702aa1e45527509bec73dad9b8d443f449c0379b (patch)
tree0f017fea62885a964c1aab16d1869979d8569021 /src/remote
parente7d8220788b4fa7c266a1e4457591b694478771c (diff)
fix: require explicit consent for remote server replacement
Diffstat (limited to 'src/remote')
-rw-r--r--src/remote/attach.rs23
-rw-r--r--src/remote/saved.rs4
2 files changed, 15 insertions, 12 deletions
diff --git a/src/remote/attach.rs b/src/remote/attach.rs
index 81810411..10db88a6 100644
--- a/src/remote/attach.rs
+++ b/src/remote/attach.rs
@@ -91,12 +91,12 @@ pub(crate) fn prepare_saved_ssh(target: &str, session_name: &str) -> io::Result<
manage_ssh_config,
session_name.to_owned(),
);
- let prepared = prepare_remote_herdr(&ssh, true, true)?;
+ let prepared = prepare_remote_herdr(&ssh, false, true)?;
ensure_remote_server_ready(
&ssh,
&prepared.remote_herdr,
prepared.stop_after_install_approved,
- true,
+ false,
true,
)?;
@@ -673,11 +673,13 @@ pub(super) fn prepare_remote_herdr(
require_surface_interest,
)?;
}
- confirm_remote_install(
- &ssh.destination(),
- &remote_herdr,
- &install_source_description(&remote_herdr.platform, override_binary.as_deref()),
- )?;
+ if !stop_after_install_approved {
+ confirm_remote_install(
+ &ssh.destination(),
+ &remote_herdr,
+ &install_source_description(&remote_herdr.platform, override_binary.as_deref()),
+ )?;
+ }
let source = resolve_install_source(&remote_herdr.platform, override_binary)?;
let install_result = ssh.install_herdr(&remote_herdr, &source.path);
source.cleanup();
@@ -1173,7 +1175,7 @@ fn confirm_remote_install_with_running_server(
eprintln!(
"To complete the remote update, Herdr must stop the running remote server after installing."
);
- eprintln!("This stops active remote pane processes, including shells, dev servers, and tests.");
+ eprintln!("This stops active remote pane processes, including shells, agents, dev servers, and tests.");
eprintln!();
eprint!(
"Install {} and stop the remote server now? [y/N] ",
@@ -1396,15 +1398,16 @@ fn confirm_remote_server_stop(
}
}
+ eprintln!("This stops active remote pane processes, including shells, agents, dev servers, and tests.");
let prompt = if required_upgrade {
- "update the remote server and continue attaching? [Y/n] "
+ "stop and update the remote server, then continue attaching? [y/N] "
} else {
"restart the remote server now? [y/N] "
};
eprint!("{prompt}");
io::stderr().flush()?;
- if read_remote_confirmation(&mut io::stdin().lock(), required_upgrade)? {
+ if read_remote_confirmation(&mut io::stdin().lock(), false)? {
return Ok(true);
}
if required_upgrade {
diff --git a/src/remote/saved.rs b/src/remote/saved.rs
index 47684758..5b570af4 100644
--- a/src/remote/saved.rs
+++ b/src/remote/saved.rs
@@ -40,7 +40,7 @@ pub(crate) fn connect_saved_ssh(
pub(crate) fn saved_ssh_bootstrap_command(target: &str, session: &str) -> String {
format!(
- "herdr --remote {} --session {} --handoff",
+ "herdr --remote {} --session {}",
super::shell_quote(target),
super::shell_quote(session)
)
@@ -112,7 +112,7 @@ mod tests {
fn bootstrap_command_preserves_the_explicit_remote_session() {
assert_eq!(
saved_ssh_bootstrap_command("build host", "agent work"),
- "herdr --remote 'build host' --session 'agent work' --handoff"
+ "herdr --remote 'build host' --session 'agent work'"
);
}