-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(std.Progress): some follow-ups #13148
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
Conversation
I think this may be helpful in the future when we might want to calculate this again at some other point. It also makes it more clear that the other two functions below it are only required for this calculation.
For general output testing, this shouldn't always be required and is only sometimes useful.
We should now be able to handle virtually any window size gracefully.
|
I've noticed, for the first time ever, my terminal getting into a weird locked-up state sometimes. I haven't managed to figure out how to reproduce it, but it happens after a compilation completes successfully. No keyboard inputs are reflected in the terminal, however I can type |
I have noticed this causing my terminal to stop accepting input sometimes. The previous implementation with all of its flaws was better in the sense that it never caused this to happen. This commit has multiple reverts in it: Revert "Merge pull request #13148 from r00ster91/progressfollowup" This reverts commit cb257d5, reversing changes made to f5f28e0. Revert "`std.Progress`: fix inaccurate line truncation and use optimal max terminal width (#12079)" This reverts commit cd3d8f3.
|
@andrewrk sure, seems like the best thing to do for now. Sorry for the trouble. Line 236 in ab4e696
This function temporarily puts your terminal into a state that would be regarded as "broken" in order to read the escape sequence's output. Line 247 in ab4e696
One thing you could try is to panic in there in order to see if that's what you're hitting. I can really not imagine any other place where what you are describing could be happening. Or could it be a similar issue to #13198? That issue is caused by the same function (and more specifically those tc attr functions that manipulate the terminal). Or actually... maybe this is a race condition? As a last resort we could remove |
|
I do think this could be a race condition because if you look at those two tc attr calls you can see we do TLDRSo if you ever do find the time, could you try to put a panic in that defer and or just not call Also what exactly are you running on? On MIPS we have some incorrect constants (causing #13198). Maybe there's a similar issue for the thing you are running on. |
|
I noticed that it happens 100% consistently when I run zig-bootstrap (master branch) and the build completes successfully. This is on x86_64-linux. One other possible factor - I was doing some advanced troubleshooting and had inadvertently left a process (might have been zig, might have been cmake) suspended in the background (i.e. with Ctrl+Z) so perhaps that had something to do with it? |
|
Sorry for the late reply. I've been trying to build with zig-bootstrap, and I'm still building... Maybe you can compile faster: as the zig sources aren't updated yet, can you try to just modify the code manually and put a panic here const chars_already_printed = 0;and see what that does? I expect the latter to "fix" the issue. |
|
Sorry, I won't have time to troubleshoot this for a while. I'm typing up the release notes for 0.10.0 and also behind on a bunch of bug fixes that I really want to try to get in before the release is cut. |
Does Zig need to change the terminal mode? If we do change the terminal mode, we should also be catching all terminating signals and vectored exceptions and restoring the mode there. Also note that there's no full-proof way to always restore the mode when we exit, for example. if someone kills the Zig compiler process with certain signals then Zig won't even get a chance to restore the terminal. This is just one of the drawbacks you have to accept when you decide you need to change the terminal mode. If not changing the terminal mode means there are some more cases where we can't support progress update then maybe that's fine? I don't know what we're changing about the mode though, maybe it is necessary? P.S. Now that I think about it, terminal attributes should have probably been implemented as "process-specific". Meaning, once the process who set them has exited, they get restored. Can't really change it now but maybe future generations will do better :) |
This is why we were doing it in Line 241 in ab4e696
It's so that if we have one then a second etc. So here we have one So it's just so that we don't print past the terminal width even if there has already been output on the same terminal line before us. As for the issueI got the bootstrap finished eventually and was able to reproduce the issue of the terminal being broken after a successful compilation as well. Then I tried adding a
|
Just some follow-ups to #12079
Some things mentioned here could still be fixed in the future in some way.
Fixes #13150