[FIX][FEUTURE] Исправил clear из консоли лаунчера.

This commit is contained in:
Alex Dev Sm 2019-06-18 03:33:17 +03:00
parent f0c6c75b14
commit bd819ac60e
3 changed files with 17 additions and 3 deletions

View file

@ -131,6 +131,9 @@ function initConsoleScene() {
consoleMenu.lookup("#send").setOnAction(function(){ consoleMenu.lookup("#send").setOnAction(function(){
execCommand(text.getText()); execCommand(text.getText());
text.setText(""); text.setText("");
if (text.getText()=="clear") {
}
}); });
FunctionalBridge.addPlainOutput(function(string) { FunctionalBridge.addPlainOutput(function(string) {
appendFunction(string+"\n"); appendFunction(string+"\n");

View file

@ -153,5 +153,5 @@ public List<Category> getCategories() {
public abstract void bell() throws IOException; public abstract void bell() throws IOException;
public abstract void clear() throws IOException; public abstract void clear() throws IOException, InterruptedException;
} }

View file

@ -18,8 +18,19 @@ public void bell() {
} }
@Override @Override
public void clear() { public void clear() throws IOException, InterruptedException {
throw new UnsupportedOperationException("clear terminal"); //throw new UnsupportedOperationException("clear terminal");
String os = System.getProperty("os.name");
if (os.contains("Windows"))
{
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
}
else
{
Runtime.getRuntime().exec("clear");
}
} }
@Override @Override