-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
progress.rs: don't fail if not a tty #6395
Conversation
Thanks for the PR! This was originally done intentionally because most pipes don't handle the commands we later use for things like clearing a line too well (and redirecting to a file looks weird with the progress bar and such). That being said perhaps we could add an option to force the progress bar to show up even if the output isn't a TTY? |
I personally would prefer a config option (which would implicitly support an env var), though not everyone agrees. cc #5721 |
Something like this? |
Seems reasonable to me! Let's see what others think. @rfcbot fcp merge As one question, do others have thoughts on the name? Would we maybe want to generalize |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Do we want this to be a |
I still lean towards a config var myself. Either way, I definitely think it should be generalized with a string. There have been several requests for a way to force it off. The current solution of CI=1 is pretty hacky. |
@ehuss so you want to see e.g. --progress=on and --progress=off? |
This is the sort of env var I wish we didn't have to have: it would be ideal to me if tools wrapping cargo and piping its output were dealing with a lower level CLI, and the primary user focused CLI were just opinionated about what its output looks like. That said, users have problems now so I don't know what else to do. |
I'm also in favour of a config var and using a string. I'd prefer something more descriptive than on and off, e.g., |
Let's default to "auto" (progress if tty) and have |
I don't have a strong opinion about the text. One option is to mirror the |
From what others have said and remembering about |
@alexcrichton The ability to say "always" in configuration can lead to some awful breakage if tools expect to parse the command-line output. |
This feels like the kind of arbitrary additions to the surface area of the CLI arguments, config keys and env vars that we don't want to rush out. How many users of Bitbake (and similar) are we trying to cater to? How important is this capability for them? I don't mean to ask that in a harsh way, just trying to understand better. |
☔ The latest upstream changes (presumably #6615) made this pull request unmergeable. Please resolve the merge conflicts. |
The --progress switch will cause progress updates to be output, even if the output device is not a TTY.
I don't understand the macOS failure in Travis |
I've seen |
@rfcbot fcp cancel I'm gonna cancel the FCP request has this has gone a bit stale. @srwalter would you be up for switching this to a config option like I mentioned above? |
@alexcrichton proposal cancelled. |
I'm gonna go ahead and close this due to inactivity, but it can of course be resubmitted! |
I like this proposal. Cargo wrappers are sometimes helpful and the progress bar really keeps things feeling snappy. I guess an alternative proposal would be to grab the build-plan beforehand and recreate the progress bar as the piped output is updated. |
It's not clear that it was intentional for progress to be disabled when
the output is not a tty. Indeed there is reason we might want to have
progress output in that case. For example, when cargo is invoked by
bitbake, cargo's output will be run through a pipe. Bitbake can parse
out progress updates from that output, but only if cargo actually emits
them...