Windows improve notty stdin support to resolve issue 3264#3272
Open
abmclin wants to merge 4 commits into
Open
Conversation
a3f9e8c to
305f33c
Compare
Contributor
Author
|
I rebased the branch onto |
Skgland
suggested changes
Apr 11, 2026
Use better code style
Explain why no multibyte UTF-8 encoding support Disable `bytes()` clippy warning about performance penalty due to unbuffered bytes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes #3264
I opened another PR to fix a different issue: #3271 may you please apply that PR before merging this one?(PR 3271 has been merged now) Although both issues are unrelated, they affectscryer-prologsubprocess I/O behavior on Windows.Basically, it adds a fallback mode for the case when
scryer-prologis running on Windows and attached to a non-tty stdin. After trying a few approaches which ultimately did not work, I adopted the simplest one: reading one byte at a time from stdin and converting to a character if it is a valid ASCII codepoint and wrapping it as aKeyEventto return to the caller, preserving theget_key's interface.The fallback mode provides limited support in the sense that it doesn't capture
Crtl-CorReturnkey presses because of the vagaries of non-tty IPC on Windows and it cannot provide any guarantees other than delivering characters that are ASCII codable. It performs no decoding of multi-byte Unicode code points. It works well and fixes the hanging problem when prompting user input for continuing solution enumeration.Fortunately, the lack of multibyte Unicode characters is not an issue because
get_keyis only used to implement the simple user interaction interface which solely is made out of characters from the ASCII subset of UTF8.Out of the following available key characters to interact with
scryer-prologenumeration:The only one that doesn't work is the
RETURNkey due to how it's treated by Windows OS but I think this is a perfectly acceptable compromise since.is still available as an alternative.I tested on Windows and Linux, and I ran tests on both, I don't see any regressions on either platform.
I did notice that on Windows, tests covering file operations all failed but I think that's just due to Windows idiosyncrasies and not related to this PR's changes.
I want to note that there are no test cases covering this PR's issue. I tried adding some but weren't successful to complexities of Windows IPC. All of my testing has been manual.