Skip to content

Commit 3076c57

Browse files
committed
Possible endless loop on windows when the event reading loop fails, fixes #51
1 parent 5e790b1 commit 3076c57

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

src/main/java/org/jline/terminal/impl/AbstractWindowsTerminal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public void close() throws IOException {
173173
writer.close();
174174
}
175175

176-
protected abstract byte[] readConsoleInput();
176+
protected abstract byte[] readConsoleInput() throws IOException;
177177

178178
protected String getEscapeSequence(short keyCode) {
179179
String escapeSequence = null;

src/main/java/org/jline/terminal/impl/jansi/JansiWinSysTerminal.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,8 @@ public Size getSize() {
5454
return size;
5555
}
5656

57-
protected byte[] readConsoleInput() {
58-
// XXX does how many events to read in one call matter?
59-
INPUT_RECORD[] events = null;
60-
try {
61-
events = WindowsSupport.readConsoleInput(1);
62-
} catch (IOException e) {
63-
Log.debug("read Windows terminal input error: ", e);
64-
}
57+
protected byte[] readConsoleInput() throws IOException {
58+
INPUT_RECORD[] events = WindowsSupport.readConsoleInput(1);
6559
if (events == null) {
6660
return new byte[0];
6761
}

src/main/java/org/jline/terminal/impl/jna/win/JnaWinSysTerminal.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,8 @@ public Size getSize() {
5555
return new Size(info.windowWidth(), info.windowHeight());
5656
}
5757

58-
protected byte[] readConsoleInput() {
59-
// XXX does how many events to read in one call matter?
60-
Kernel32.INPUT_RECORD[] events = null;
61-
try {
62-
events = doReadConsoleInput();
63-
} catch (IOException e) {
64-
Log.debug("read Windows terminal input error: ", e);
65-
}
58+
protected byte[] readConsoleInput() throws IOException {
59+
Kernel32.INPUT_RECORD[] events = doReadConsoleInput();
6660
if (events == null) {
6761
return new byte[0];
6862
}

0 commit comments

Comments
 (0)