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 5e790b1 commit 3076c57
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 @@ -173,7 +173,7 @@ public void close() throws IOException {
writer.close();
}

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

protected String getEscapeSequence(short keyCode) {
String escapeSequence = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,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 @@ -55,14 +55,8 @@ public Size getSize() {
return new Size(info.windowWidth(), info.windowHeight());
}

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 3076c57

Please sign in to comment.