-
Notifications
You must be signed in to change notification settings - Fork 218
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
Ability to stop reading the input stream #140
Comments
Work in progress branch at https://github.com/gnodet/jline3/tree/issue-140 |
So I've solved this so far on windows (haven't looked at any UNIX impls yet), with a less low level way of solving it than described above, however with 1 small bug. Instead of getting low level and using Any ideas of why the first input is still hijacked by the reader (Still need to do some debugging on this)? Maybe this is why you wanted to go lower level with |
The above problem can be fixed by having the This can be fixed a little more natively with JNA by adding a What would be better waiting n milliseconds and timing out with |
|
This commit is currently mostly about using non blocking input streams in the Terminal.
If you want to give a try to the new PR, that would be nice. The basics are here I think, but I haven't done much testing. |
This commit is currently mostly about using non blocking input streams in the Terminal.
I've merged the commits above in master. |
What is the anticipated release date of 3.6.0? I should be able to find some time tonight to test master, as for the last several weeks I've been using my own locally edited version of my own implementation. Been a bit busy so apologies for the delay in testing this for you. |
Nothing's set in stone for the release date, but I'd like to get it out in a 2-3 weeks max, maybe sooner if everyone's happy with it. |
Is there a local Jansi change you have? I've cloned Jansi 1.17-SNAPSHOT but am getting "JansiWinSysTerminal.java:[75,46] error: method readConsoleInput in class WindowsSupport cannot be applied to given types;" when compiling JLines master branch. |
Yes, sorry I forgot to commit the jans-native change, see fusesource/jansi@402e4ae |
Confirmed this works from Windows over both CMD Prompt and Cygwin! Please let me know if there is anything else I can do to help. |
I have upgraded to 3.6.0 and am seeing some bugs in Windows 10 command prompt. After a pause and resume, my input gets messy. I'll push a key and sometimes it won't be recognized (at least no output on the screen) and others the same key gets output many times. Any ideas? I haven't tested yet in other terminals and I'll do some deeper digging later. |
This happens when the pause() and resume() are toggled quickly. Shouldn't the pause() method block until the console is truly paused? In the implementation I had written, I had the pause method block until the console pauses, throwing an interrupted exception. This also would protect the pump reader thread from potentially grabbing quickly entered input after the pause(). |
Yeah, I think there's definitely a possible problem if the the pump thread is not done before resume is called. Would you be able to provide a PR ? |
Yes, I can find some time tonight to do this. |
See the pull request for this: #228 I've test it on Windows command prompt and cygwin. |
Related to #138, it would be interesting to have a way to stop reading the main terminal input stream in advance for signal processing.
While adding a couple of methods
pause() / resume() / isPaused()
to theTerminal
interface is easy, the problem is that the implementation can not easily interrupt its reading. So this would require a smarter control of the underlying input stream.On Windows, it may be achievable using
WaitForSingleObject
on the console handle to actually wait until there are some events to read. However, this method is missing in the jansi library.On Unix, we may 2 possibilities that would require investigation: using a
FileChannel
on top of theInputStream
(when it's based on a real unix pipe) and check if the reading thread can actually be interrupted or when using aPty
, it may be possible to set theVTIME
flag to set the timeout (in tenth of seconds) so that the read will unblock automatically.The text was updated successfully, but these errors were encountered: