fix: machine init/add fall back to plain output when stdout isn't a TTY (#386)#395
Open
joeblew999 wants to merge 1 commit into
Open
fix: machine init/add fall back to plain output when stdout isn't a TTY (#386)#395joeblew999 wants to merge 1 commit into
joeblew999 wants to merge 1 commit into
Conversation
…a TTY The readiness spinners (huh) open /dev/tty, so 'uc machine init/add' died headless (CI, SSH, mise) — we had to wrap it in a PTY (script -q /dev/null), which swallowed errors. Guard both spinners with tui.IsStdoutTerminal() (the pattern connect.go already uses); headless gets a plain log + the real error. Upstreamable: psviderski#386.
Contributor
|
Think it may make more sense to put more things I the client/tui package
and do things there. This also allows for a, maybe, different kind of
spinner used in both cases.
The duplicated comment also points to the need for something slightly more
generic imo
Cheers
…On Sun, Jun 7, 2026, 14:01 Gerard Webb ***@***.***> wrote:
Fixes #386 <#386>.
uc machine init and uc machine add use huh readiness spinners that open
/dev/tty, so they die in shells with no controlling terminal (CI, SSH
automation, task runners) even with -y. Today the only workaround is
wrapping the command in a PTY (script -q /dev/null …), which also
swallows the real error on failure.
This guards both spinners with tui.IsStdoutTerminal() and falls back to a
plain log + direct wait when stdout isn't a terminal — the exact pattern
connectClusterWithProgress already uses. Headless now works without a
PTY, and errors surface normally.
- cmd/uncloud/machine/init.go — "Waiting for the cluster to be
ready..."
- cmd/uncloud/machine/add.go — "Waiting for the machine to join the
cluster..."
No behaviour change in a terminal (spinner as before).
------------------------------
You can view, comment on, or merge this pull request online at:
#395
Commit Summary
- 5704136
<5704136>
fix(cli): machine init/add fall back to plain wait when stdout isn't a TTY
File Changes
(2 files <https://github.com/psviderski/uncloud/pull/395/files>)
- *M* cmd/uncloud/machine/add.go
<https://github.com/psviderski/uncloud/pull/395/files#diff-67ea6f05ae2e430e4860f5d0ac0621e54dc580c9c4cedb720e2cf60692a0a60e>
(35)
- *M* cmd/uncloud/machine/init.go
<https://github.com/psviderski/uncloud/pull/395/files#diff-27a43e29ab41e7ea51c4f46e56bd0f4f67c94414184917714ca665ca2536bebc>
(35)
Patch Links:
- https://github.com/psviderski/uncloud/pull/395.patch
- https://github.com/psviderski/uncloud/pull/395.diff
—
Reply to this email directly, view it on GitHub
<#395?email_source=notifications&email_token=AACWIW2T5EXYSBTNFO7O74L46VKQ7A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTQMJYHAYTCNBSGOTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACWIWY7QQBHALIVO4STPRL46VKQ7AVCNFSM6AAAAACZ54HE5WVHI2DSMVQWIX3LMV43ASLTON2WKOZUGYYDOMRTG44DIOA>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AACWIWZB577U7NHWEIG4UD346VKQ7A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTQMJYHAYTCNBSGOTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/AACWIW2WZTVVSDJNWLBQ7GT46VKQ7A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTQMJYHAYTCNBSGOTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #386.
uc machine initanduc machine addusehuhreadiness spinners that open/dev/tty, so they die in shells with no controlling terminal (CI, SSH automation, task runners) even with-y. Today the only workaround is wrapping the command in a PTY (script -q /dev/null …), which also swallows the real error on failure.This guards both spinners with
tui.IsStdoutTerminal()and falls back to a plain log + direct wait when stdout isn't a terminal — the exact patternconnectClusterWithProgressalready uses. Headless now works without a PTY, and errors surface normally.cmd/uncloud/machine/init.go— "Waiting for the cluster to be ready..."cmd/uncloud/machine/add.go— "Waiting for the machine to join the cluster..."No behaviour change in a terminal (spinner as before).