Skip to content

Commit 0b6e8f1

Browse files
committed
Fix Ctrl+C again
1 parent 6ddc09b commit 0b6e8f1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/java/org/mcphackers/mcp/main/MainCLI.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,18 @@ public MainCLI(String[] args) {
9393
while (startedWithNoParams && !exit || !startedWithNoParams && executeTimes < 1) {
9494
while (args.length < 1) {
9595
System.out.print(new Ansi().fgBrightCyan().a("> ").fgRgb(255,255,255));
96-
String str = "";
96+
String str = null;
9797
try {
98-
str = console.readLine().trim();
98+
str = console.readLine();
9999
} catch (NoSuchElementException ignored) {
100+
}
101+
if (str == null) {
100102
mode = TaskMode.EXIT;
103+
} else {
104+
str = str.trim();
105+
System.out.print(new Ansi().fgDefault());
106+
args = str.split(" ");
101107
}
102-
System.out.print(new Ansi().fgDefault());
103-
args = str.split(" ");
104108
}
105109
boolean taskMode = setMode(args[0]);
106110
Map<String, Object> parsedArgs = new HashMap<>();

0 commit comments

Comments
 (0)