-
Notifications
You must be signed in to change notification settings - Fork 29
use scrolling mode when used non-interactively #59
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
Ooh, this is a bit of a tough call. On the one hand, we've traditionally wanted to stick to Standard C and this has some consequences at least on Windows (even trying to figure out exactly what we would need to do from https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-isatty?view=msvc-170 wasn't immediately clear to me). On the other hand, I can see how our traditional approach of putting Even strictly in a unix context, although this kind of |
Why not make "continuous" the default in every case ? |
Because it's not good for regular use: if I use I will replicate the alternative suggestions I posted on the other issue here:
By the way, you can also make tests to click through the prompts: you just have to say |
I'm now leaning towards this solution. It isn't hard to implement, and I guess feels like the right balance in terms of keeping things simple, but not too simple.
The more I think about this the more I'm not especially bothered by this factor. The boilerplate output (e.g. size of empty.expected) goes from 9 lines to 10. I've submitted a pull request for this one at #62 |
Replying to @jkingdon, #62 (comment):
Could you elaborate on how this breaks windows? I see it's a deprecated function on windows but it sounds like it should work anyway. I'd rather not drop windows support just for this (or at all, really), but we can use preprocessor flags if necessary. I will try this out on windows myself and see what the situation is. (We should also run the tests on windows in CI; I think this is not hard to set up.) |
Windows doesn't have unistd.h does it? (I'm thinking of the Visual Studio compiler or whatever the vanilla windows setup is these days, not like cygwin or whatever Microsoft calls their latest linux subsystem or whatever it is).
Both of those seem like a better idea than me trying to find the answer based on dim memories or trying to find the right documentation by internet searches and not being sure I understand it correctly. |
Okay, I have a tested setup now. On windows we call the |
Well, first of all thanks for digging into this. I'm not sure I have a lot of firm conclusions except the obvious "looks like this isn't as simple as we might have been hoping". Aside from Windows are there any environments we might care about which just support Standard C? I'm thinking of things like https://compcert.org/man/manual005.html#sec49 although at least for now their answer seems to be "we are worrying about the compiler, not the OS or standard library". Another example would be if there are compilers which emit Proof Carrying Code or ...... well I'm not sure how much these things even exist, especially for C, I'm just thinking if they did metamath enthusiasts might be a bit more likely than most people to care about them. |
Okay. I'm a little sad this can't just automagically work on every system but it's more important that we don't regress the user experience than the tests, so false positives are not good. I'm closing this PR, but if new information comes up regarding terminals in use or better ways to implement the check then we can revisit this. |
Use
isatty
to find out whether the user is typing directly in the terminal or if this is a tool-driven run, and set the default scroll mode accordingly. This should help tests to avoid hanging on input.