Skip to content

Commit

Permalink
Use less for !manual command if not Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Aug 23, 2018
1 parent 5ea9305 commit 67e67c8
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/sqlline/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,26 @@ public void manual(String line, DispatchCallback callback)
return;
}

// Workaround for windows because of
// https://github.com/jline/jline3/issues/304
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
sillyLess(in);
} else {
try {
org.jline.builtins.Commands.less(sqlLine.getLineReader().getTerminal(),
in, sqlLine.getOutputStream(), sqlLine.getErrorStream(),
null, new String[]{});
} catch (InterruptedException e) {
callback.setToFailure();
sqlLine.error(e);
return;
}
}

callback.setToSuccess();
}

private void sillyLess(InputStream in) throws IOException {
BufferedReader breader =
new BufferedReader(new InputStreamReader(in));
String man;
Expand All @@ -1484,8 +1504,6 @@ public void manual(String line, DispatchCallback callback)
}

breader.close();

callback.setToSuccess();
}

static Map<String, String> asMap(Properties properties) {
Expand Down

0 comments on commit 67e67c8

Please sign in to comment.