Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

Review fixes: the tincan copy is renamed into place on update

Lars Talian8b591bf11e56
diff --git a/src/daemon/update.rs b/src/daemon/update.rs
index 5922a0a..6521887 100644
--- a/src/daemon/update.rs
+++ b/src/daemon/update.rs
@@ -70,8 +70,11 @@ async fn update() -> Result<Option<String>> {
if !out.status.success() {
bail!("install failed: {}", String::from_utf8_lossy(&out.stderr).trim());
}
- if waiting && std::fs::remove_file(&copy).is_ok() {
- let _ = std::fs::copy(&exe, &copy);
+ // A new file renamed over it: never a moment without tincan, nor a half-written one. (A tincan.exe that's running
+ // can't be replaced: it stays as it was, still handing over to us.)
+ let new = copy.with_extension("new");
+ if waiting && std::fs::copy(&exe, &new).is_ok() && std::fs::rename(&new, &copy).is_err() {
+ let _ = std::fs::remove_file(&new);
}
// Restart only on a binary that really is newer (a release tagged without bumping its version must not loop).
let installed = tokio::process::Command::new(&exe).arg("--version").kill_on_drop(true).output();
diff --git a/src/main.rs b/src/main.rs
index a1708e3..1a321c2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -410,6 +410,9 @@ async fn cli(cmd: Cmd) -> Result<()> {
let copied = wizard::interactive() && wizard::copy(&l.url);
println!("Team link for {}{}:\n\n{}\n", l.team, if copied { " (on your clipboard)" } else { "" }, l.url);
println!("Anyone with it can join: it opens a page with one command. `{CLI} link --new` replaces it.");
+ if managed() {
+ println!("Teammates in your Reason workspace just run `reason network`; the link is for anyone else.");
+ }
}
Cmd::Invite { me: false, code: false, .. } => Box::pin(cli(Cmd::Link { new: false })).await?,
Cmd::Setup { dry_run: false, remove: false, no_service: false } if wizard::interactive() => {