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

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

View file

@ -130,6 +130,9 @@ function initConsoleScene() {
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
consoleMenu.lookup("#send").setOnAction(function(){
execCommand(text.getText());
if (text.getText()=="clear") {
output.setText("");
}
text.setText("");
});
FunctionalBridge.addPlainOutput(function(string) {

View file

@ -153,5 +153,5 @@ public List<Category> getCategories() {
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
public void clear() {
throw new UnsupportedOperationException("clear terminal");
public void clear() throws IOException, InterruptedException {
//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