-
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
Build progressbar interleaved with rustc errors #5695
Comments
Thanks for the report! cc @kennytm, I had forgotten about this interaction :( I'm not sure how to solve this without capturing rustc's errors which we don't currently have the ability to do without losing formatting :( |
This is primarily blocked on rust-lang#5695 which unfortunately doesn't have a great fix today, so disable it for now while we try to work out a better solution. Closes rust-lang#5695 Closes rust-lang#5697
Silly question, what prevents multiple rustc invocations from having their
output mix? Perhaps we can join in that system.
|
@Eh2406 it depends on the platform. On Windows there is a global lock between rustc processes. On other platforms, the only coordination is to rely on the operating system to flush data in atomic blocks. In POSIX this is typically |
It's true though! We might be able to create a protocol between Cargo and rustc about how errors are coordinated and that could buy Cargo more flexibility in this regard |
I seem to remember a discussion about extracting rustc's error formatting machinery into a reusable crate (though I can't find that discussion, sorry!). If that happened, would using rustc's JSON output be enough, as cargo could use that crate to recreate the errors? |
Indeed! If that happened we could safely capture rustc's output and render it to the console in Cargo as rustc would. |
Regarding error buffering, I don't think we need to parse rustc's JSON output? I think my idea here is a more generic way to achieve this. |
@ishitatsuyuki Cargo currently needs to know the terminal size for the progress bar. This is done by |
@kennytm I believe that the solution here is to buffer all rustc output until the invocation ends, and rustc should never be interactive or display a progress indicator as it's not a compiler's job but the build tool's. Though, if we ever need to RPC with rustc, we can change the implementation when we do. I'd say that there's not much motivation for it to be done in the near future, though. |
Please don't, That would drastically increase the time before the first errors are printed in some cases. |
@bjorn3 To address that, we can stream the output in the case that only one rustc is running. Otherwise, buffering benefits more because you don't want the error contexts to be mixed up anyway. |
@kennytm Yes, this is expected. As I wrote before, we should parse all ANSI escapes (limiting to colours) and feed them again into termcolor, making it a portable solution. |
Just throwing a vague idea in, I'm not sure if that would work or be portable. I think the ncurses (and likely other curses) libraries allow to split the terminal into multiple windows that scroll independently. If the progress bar lived in one and rustcs (and other possible things, liku build scripts) run in the other, they should not interact. Or how do things like screen or tmux work? Do they create a pty for the child processes and process that? |
@vorner What are you suggesting that is not portable? The width detecting progress bar or the buffering approach? I think tmux creates a pty for each pane indeed. |
I didn't say it is not portable. I only said I didn't do any research so I don't know if it is or not. And I was talking about the ncurses windows and PTYs. |
Fully capture rustc and rustdoc output when -Zcompile-progress is passed Fixes #5764 and #5695. On Windows, we will parse the ANSI escape code into console commands via my `fwdansi` package, based on @ishitatsuyuki's idea in #5695 (comment). Outside of Windows the content is forwarded as-is.
…once rust-lang#5695 is fixed The issue has been resolved and the compile-progress has been reenabled already.
job queue: remove outdated comment about reenabling compile-progress once #5695 is fixed The issue has been resolved and the compile-progress has been reenabled already.
The text was updated successfully, but these errors were encountered: