mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] Исправил clear в std
This commit is contained in:
parent
386f8d07bc
commit
3201be72cc
2 changed files with 19 additions and 3 deletions
|
@ -136,6 +136,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) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
public class StdCommandHandler extends CommandHandler {
|
||||
|
@ -18,8 +18,21 @@ public void bell() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException("clear terminal");
|
||||
public void clear() throws IOException {
|
||||
System.out.flush();
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
||||
{
|
||||
try {
|
||||
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
|
||||
} catch (InterruptedException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.print("\033[H\033[2J");
|
||||
System.out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue