Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix IDAKLU solver crash when running in multiple threads + when telemetry is prompted for #4583
Fix IDAKLU solver crash when running in multiple threads + when telemetry is prompted for #4583
Changes from 13 commits
8709969
6fccf68
9348522
c89ee9c
b675502
e8680df
af0de0f
925cbd6
d8d37ed
fbb623e
0826afe
1da3d91
4f8b48c
91379bd
de60647
083184b
6f077e3
7433555
57553df
e4859dc
5495814
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems excessive that we need to change the terminal settings for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this allows you to do is that you don't get new indentation when you write to the terminal again. I wrapped this in a try-finally block based on the Python docs: https://docs.python.org/3/library/termios.html#example.
So, by saving the attributes, I'm trying to disable the fact that
sys.stdout.write("\n")
will not return the cursor to the leftmost position (because we are in raw mode and we need to do that manually instead – for which I want to avoid).We end up with this, otherwise:
and this would break one's terminal until one restarts it – a more robust solution could be to use
TCSAFLUSH
instead ofTCSADRAIN
, I'll switch to that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are already using select, do we need the loop? The timeout isn't very long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I checked and this loop ended up being required – since while normal
input()
in Python blocks indefinitely, I found that there's no (built-in) way to timeout if we are in raw terminal mode (set above intty.setraw()
). So we need to manually handle everything, which is to read the "y" or "n" or empty characters and flush them to the screen.select
lets us say "wake me up when, either":which the loop apparently allows us to do. But if you have something else in mind, I'm happy to try that.