Skip to content

Commit

Permalink
Possible endless loop on windows when the event reading loop fails, f…
Browse files Browse the repository at this point in the history
…ixes #51
  • Loading branch information
gnodet committed Dec 5, 2016
1 parent 1970ed7 commit 972a85a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void close() throws IOException {
writer.close();
}

protected abstract byte[] readConsoleInput();
protected abstract byte[] readConsoleInput() throws IOException;

protected String getEscapeSequence(short keyCode) {
// virtual keycodes: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,8 @@ public Size getSize() {
return size;
}

protected byte[] readConsoleInput() {
// XXX does how many events to read in one call matter?
INPUT_RECORD[] events = null;
try {
events = WindowsSupport.readConsoleInput(1);
} catch (IOException e) {
Log.debug("read Windows terminal input error: ", e);
}
protected byte[] readConsoleInput() throws IOException {
INPUT_RECORD[] events = WindowsSupport.readConsoleInput(1);
if (events == null) {
return new byte[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,8 @@ public Size getSize() {

private char[] mouse = new char[] { '\033', '[', 'M', ' ', ' ', ' ' };

protected byte[] readConsoleInput() {
// XXX does how many events to read in one call matter?
Kernel32.INPUT_RECORD[] events = null;
try {
events = doReadConsoleInput();
} catch (IOException e) {
Log.debug("read Windows terminal input error: ", e);
}
protected byte[] readConsoleInput() throws IOException {
Kernel32.INPUT_RECORD[] events = doReadConsoleInput();
if (events == null) {
return new byte[0];
}
Expand Down

0 comments on commit 972a85a

Please sign in to comment.