From 57fa2048f94ac1975ed4a417fbc0150dd9277f00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 18 Oct 2014 15:32:23 +0200 Subject: [PATCH] Flush output after every command. --- src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 1 + .../java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java | 1 - .../java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java | 1 - src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java | 1 - src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java | 1 - 5 files changed, 1 insertion(+), 4 deletions(-) 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); } -- 2.7.4