-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to show output on error #371
Add option to show output on error #371
Conversation
This is really needed for when commands fail. Otherwise there's no good error messages from stderr and your users have to re-run the command by hand trying to debug why it failed. |
Hey, thanks for the contribution. Can we call this |
Co-authored-by: Maas Lalani <[email protected]>
Co-authored-by: Maas Lalani <[email protected]>
@hopefulTex could you take a look at this PR. You changed some stuff that this PR depends on, and I'm not sure how to do it now. I think this would still be a really useful feature so maybe you could help make this PR work |
Pardon the dust! Adding a distinction is definitely useful, I'd love to get this updated soon but a few questions still remain. Currently spin is supposed to show both the output and the error in one block, with the ui being displayed in the
I'll be updating this to match with the current version of gum, but I believe these questions are probably better answered by people who want/need this for their script or workflow (not me). |
My preferred implementation (I want to use it in a script, and I was using my previous implementation in a script already). Is that stdout and stderr are combined by the system (idk how this works in go but the unix system call is dup2), so that it is the same as if running the command on the shell, and messages on stdout and stderr are interleaved. Only when the subcommand exits with a non-0 exit code, will the output be shown to the user
stderr seems like it makes sense
no distinction is needed, as it should read the same as if the command was normally executed in a user shell session
I don't think it makes sense to use the --show-output flag in combination with this feature
meant for humans
n/a |
So the ideal behavior is (correct me if I'm wrong): Since we won't know the exit code until the program has finished, it would be easiest (and more flexible) to spit the buffer out in one chunk at the end of execution- similar to when the output is being piped. This would make it a simple check for the |
This makes it so that if the `--show-error` flag is provided then the full output of the command will be printed if the command fails. This kind of works in conjuncture with `--show-output` in that if the command succeeds only STDOUT is pushed. If the command fails both `STDOUT` and `STDERR` are pushed. This builds off of charmbracelet#371 Resolves charmbracelet#55
Hey @jelle-bigbridge, thank you so much for the PR. A PR has been opened to fix this |
Let's close this in favour of #440 |
This makes it so that if the `--show-error` flag is provided then the full output of the command will be printed if the command fails. This kind of works in conjuncture with `--show-output` in that if the command succeeds only STDOUT is pushed. If the command fails both `STDOUT` and `STDERR` are pushed. This builds off of charmbracelet#371 Resolves charmbracelet#55
… (#518) * feat(spin): Add support for `--show-error` for the spinner. This makes it so that if the `--show-error` flag is provided then the full output of the command will be printed if the command fails. This kind of works in conjuncture with `--show-output` in that if the command succeeds only STDOUT is pushed. If the command fails both `STDOUT` and `STDERR` are pushed. This builds off of #371 Resolves #55 * chore: Fix formatting --------- Co-authored-by: Elliot Courant <[email protected]>
Fixes #55
Changes