From: David ‘Bombe’ Roden Date: Sat, 18 Oct 2014 13:32:23 +0000 (+0200) Subject: Flush output after every command. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=57fa2048f94ac1975ed4a417fbc0150dd9277f00;p=xudocci.git Flush output after every command. --- diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 016c9d0..2d0a352 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -122,6 +122,7 @@ public class CommandReader extends AbstractExecutionThreadService { Command command = eligibleCommands.iterator().next(); List parameters = from(asList(words)).skip(1).toList(); state = command.execute(state, parameters, writer); + writer.flush(); } lastLine = line; diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java index 34e0716..7a4869b 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java @@ -59,7 +59,6 @@ public class FailedDownloadsCommand implements Command { downloadIndex++; } outputWriter.write("End of failed downloads.\n"); - outputWriter.flush(); return state.setLastFailedDownloads(new ArrayList<>(failedDownloads)); } diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java index 741ed6a..7b532f7 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java @@ -72,7 +72,6 @@ public class ListConnectionsCommand implements Command { outputWriter.write(String.format("[%d] %s:%d, %s/s\n", counter++, connection.hostname(), connection.port(), f(connection.getInputRate()))); } outputWriter.write("End of connections.\n"); - outputWriter.flush(); return state.setLastConnections(lastConnections); } diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java index 45838a8..ede0024 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java @@ -98,7 +98,6 @@ public class ListDownloadsCommand implements Command { outputWriter.write(")\n"); } outputWriter.write("End of DCCs.\n"); - outputWriter.flush(); return state.setLastDownloads(downloads); } diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java index 0ae1b15..746f01c 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java @@ -87,7 +87,6 @@ public class SearchCommand implements Command { outputWriter.write(String.format("[%d] %s (%s) from %s (#%s) on %s\n", counter++, result.pack().name(), result.pack().size(), result.bot().name(), result.pack().id(), result.bot().network().name())); } outputWriter.write("End of Search.\n"); - outputWriter.flush(); return state.setLastResults(lastResult); }