carlos / platform Public

cli: ship's banner before account resolution too

runShipAPI's own banner is suppressed; the verb prints it first, so the
chooser or the muted account line never precedes the console context.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell a4f57997ec687a94c1a5306cb70208f9be1b9515 parent 7742538
1 file changed, +13 −7
  • cli.go +13 −7
diff --git a/cli.go b/cli.go
index 6fe43b475..d8e809046 100644
--- a/cli.go
+++ b/cli.go
@@ -1692,13 +1692,19 @@ func runShip(args []string) {
log.Fatal(err)
}
if sess != nil {
- // apiAccount is resolved HERE, not inside runShipAPI: it fatals on a
- // name in -account-id, and log.Fatal skips every deferred function —
- // which is the one thing runShipAPI exists to avoid (its static
- // branch defers the cleanup of a scratch tarball up to 256MiB).
- // Evaluated as an argument, the refusal lands before runShipAPI's
- // body has registered a defer at all.
- if err := runShipAPI(sess, resolvedAccount(sess, acctRaw, acctIDRaw), fs, *app, *ver, *kind, *target, *label, noteText, capsSet, true); err != nil {
+ // The banner prints BEFORE the account resolves: resolution may put
+ // a muted "account: …" line — or the whole interactive chooser — on
+ // the terminal, and a prompt with no console named yet is a question
+ // with no context. The account is still resolved HERE, not inside
+ // runShipAPI: resolvedAccount fatals (on a name in -account-id, or
+ // an ambiguous omitted -account), and log.Fatal skips every deferred
+ // function — which is the one thing runShipAPI exists to avoid (its
+ // static branch defers the cleanup of a scratch tarball up to
+ // 256MiB). Resolved before the call, the refusal lands before
+ // runShipAPI's body has registered a defer at all.
+ printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
+ if err := runShipAPI(sess, acct, fs, *app, *ver, *kind, *target, *label, noteText, capsSet, false); err != nil {
log.Fatal(err)
}
return