[cli] Disable spinner animation on non-live TTYs#4706
[cli] Disable spinner animation on non-live TTYs#4706riken127 wants to merge 3 commits intocanonical:mainfrom
Conversation
ricab
left a comment
There was a problem hiding this comment.
Thanks for the PR! I have a couple of requests and questions for clarification.
I would also like to see manual tests results exercising this in the multiple commands that use the spinner, showing correct handling of tricky cases like errors from the daemon, update prompts, password in auhenticate...
b344e47 to
485b969
Compare
Gating the spinner animation logic on the term->cout_is_live() flag. This prevents messy output (backspaces and animation frames) when Multipass is run in non-interactive environments.
485b969 to
58e0502
Compare
|
Hey @riken127, is this ready for another pass? BTW, I know approaches vary a lot on different projects, but we favor separate atomic commits, without squashing, including review requests. See GIT5 and others in CONTRIBUTING.md. It makes it easier to see new changes. No worries about the one you already pushed, just something to keep in mind going forward. |
0987866 to
2f411e5
Compare
|
Hi @ricab, Yes, i believe so! I've modified the logic and performed additional manual tests. I had to push force on my last commit to fix a minor whitespace oversight and keep the history clean; I'm sorry about that! I've verified the following cases in non-interactive mode using
Regarding the callbacks and interaction angles you mentioned, I've made start() and stop() no-ops in non-live TTYs. I'm not sure if this covers all the edge cases you were thinking of, so if I've missed a specific interaction angle, please let me know. I'd be happy to take a closer look if you could provide more detail on what else might be affected. Thank you for your patience, it took me a while to answer as I had some issues with my linux machine. Would love to hear some feedback! |
|
Cool, thanks again for your involvement @riken127! I am queuing this to review soon. |
ricab
left a comment
There was a problem hiding this comment.
Hi @riken127, I have circled back here and, after closer inspection, I don't think we can just skip messages altogether. That would prevent logs, for example, since they use AnimatedSpinner::print in the corresponding callback. And if we enable any message, better enable them all: it wouldn't make sense to eat some messages but not others depending on what exact method client code called.
Our CLI is undergoing a review right now and I don't think we should introduce radical changes until that process is concluded, so I think the cleanest approach for the time being would be to just print all messages but without the spinner clutter. IOW, when running non-interactively:
1. `print` would do the exact same that it does today (no early return)
2. `start` would print only the message (as you had it before)
3. `stop` would return early, as you have it.
I believe that is the sane compromise at this point.
Additionally, it would be good to cover this case in unit tests.
Sorry about the moving target there. Hopefully you need only revert a couple of snippets. Let us know your thoughts and thanks again for your contribution!
When stdout is not live, keep callback-visible output while avoiding spinner control-sequence clutter. Make start(message) print only the message in non-live mode and return early in stop() for non-live mode. Keep print() behavior unchanged so log lines continue to be emitted by spinner callbacks. Add unit tests covering non-live logging, reply, and iterative spinner callbacks.
addd9a8 to
607b26c
Compare
|
Hi @ricab, |
Gating the spinner animation logic on the term->cout_is_live() flag. This prevents messy output (backspaces and animation frames) when Multipass is run in non-interactive environments.
Description
This PR gates the CLI spinner's animation logic on the
term->cout_is_live()flag.Related Issue(s)
Closes #1541
Testing
./build/bin/multipass wait-ready(Verified animation is visible)./build/bin/multipass wait-ready | catGot:
Screenshots (if applicable)
N/A (Behavioural change for terminal output)
Checklist
Additional Notes