From 88dd64e79520e09e989c0a79beba09ce8221fef3 Mon Sep 17 00:00:00 2001 From: John Garland Date: Sat, 29 Sep 2012 17:45:47 +0100 Subject: [PATCH] Ensure console commands are executed in order --- deluge/ui/console/commander.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deluge/ui/console/commander.py b/deluge/ui/console/commander.py index 2b51da893..c4264c9df 100644 --- a/deluge/ui/console/commander.py +++ b/deluge/ui/console/commander.py @@ -113,16 +113,16 @@ class Commander: def on_connect(result): def on_started(result): def on_started(result): - deferreds = [] + def do_command(result, cmd): + return self.do_command(cmd) + + d = defer.succeed(None) # If we have args, lets process them and quit # allow multiple commands split by ";" for arg in args.split(";"): - deferreds.append(defer.maybeDeferred(self.do_command, arg.strip())) + d.addCallback(do_command, arg.strip()) - def on_complete(result): - self.do_command("quit") - - dl = defer.DeferredList(deferreds).addCallback(on_complete) + d.addCallback(do_command, "quit") # We need to wait for the rpcs in start() to finish before processing # any of the commands.