Flush output after every command.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 18 Oct 2014 13:32:23 +0000 (15:32 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 18 Oct 2014 13:32:23 +0000 (15:32 +0200)
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java
src/main/java/net/pterodactylus/xdcc/ui/stdin/FailedDownloadsCommand.java
src/main/java/net/pterodactylus/xdcc/ui/stdin/ListConnectionsCommand.java
src/main/java/net/pterodactylus/xdcc/ui/stdin/ListDownloadsCommand.java
src/main/java/net/pterodactylus/xdcc/ui/stdin/SearchCommand.java

index 016c9d0..2d0a352 100644 (file)
@@ -122,6 +122,7 @@ public class CommandReader extends AbstractExecutionThreadService {
                                Command command = eligibleCommands.iterator().next();
                                List<String> parameters = from(asList(words)).skip(1).toList();
                                state = command.execute(state, parameters, writer);
+                               writer.flush();
                        }
 
                        lastLine = line;
index 34e0716..7a4869b 100644 (file)
@@ -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));
        }
 
index 741ed6a..7b532f7 100644 (file)
@@ -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);
        }
 
index 45838a8..ede0024 100644 (file)
@@ -98,7 +98,6 @@ public class ListDownloadsCommand implements Command {
                        outputWriter.write(")\n");
                }
                outputWriter.write("End of DCCs.\n");
-               outputWriter.flush();
                return state.setLastDownloads(downloads);
        }
 
index 0ae1b15..746f01c 100644 (file)
@@ -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);
        }