office: promise an attach line only when a session was actually built

This commit is contained in:
Sam
2026-11-13 11:33:28 +11:00
parent bd0114a64f
commit b76dc5e6b8
4 changed files with 285 additions and 2 deletions

View File

@@ -364,8 +364,6 @@ def run_on_remote(host, folder, opts):
sys.stdout.write(out.stdout)
if out.returncode != 0:
raise h.Refused(3, "the other machine refused: %s" % (out.stderr or out.stdout).strip()[:300])
h.say("")
h.say("switch to it: tuios attach --host %s %s" % (host, opts["session"] or os.path.basename(folder)))
return 0
@@ -786,6 +784,14 @@ def main():
sys.executable,
[sys.executable, os.path.join(HERE, "board"), "--folder", folder],
)
if code == 0:
# Only now is there a session worth attaching to. Promising one earlier
# is how a person ends up trying to attach to a session that was never
# created, because the project was still waiting for its first commit.
client = opts.get("client_host") or ""
h.say("")
h.say("switch to it: tuios attach%s %s"
% (" --host " + client if client else "", session))
return code