From 4420f2fae5b6d70eb7e243c5c6bfe762ff060fa3 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 19 Jan 2010 23:00:48 +0000 Subject: [PATCH] Fix hanging when using commands from the command-line Fix displaying plugin command output on the command-line --- deluge/ui/console/commands/plugin.py | 8 ++++---- deluge/ui/console/main.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deluge/ui/console/commands/plugin.py b/deluge/ui/console/commands/plugin.py index e626e7e54..84b92e623 100644 --- a/deluge/ui/console/commands/plugin.py +++ b/deluge/ui/console/commands/plugin.py @@ -69,7 +69,7 @@ class Command(BaseCommand): for p in result: self.console.write("{!input!} " + p) - client.core.get_available_plugins().addCallback(on_available_plugins) + return client.core.get_available_plugins().addCallback(on_available_plugins) if options["show"]: def on_enabled_plugins(result): @@ -77,7 +77,7 @@ class Command(BaseCommand): for p in result: self.console.write("{!input!} " + p) - client.core.get_enabled_plugins().addCallback(on_enabled_plugins) + return client.core.get_enabled_plugins().addCallback(on_enabled_plugins) if options["enable"]: def on_available_plugins(result): @@ -90,7 +90,7 @@ class Command(BaseCommand): if arg.lower() in plugins: client.core.enable_plugin(plugins[arg.lower()]) - client.core.get_available_plugins().addCallback(on_available_plugins) + return client.core.get_available_plugins().addCallback(on_available_plugins) if options["disable"]: def on_enabled_plugins(result): @@ -103,4 +103,4 @@ class Command(BaseCommand): if arg.lower() in plugins: client.core.disable_plugin(plugins[arg.lower()]) - client.core.get_enabled_plugins().addCallback(on_enabled_plugins) + return client.core.get_enabled_plugins().addCallback(on_enabled_plugins) diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py index 5bf8df9f8..30e530002 100644 --- a/deluge/ui/console/main.py +++ b/deluge/ui/console/main.py @@ -170,7 +170,7 @@ class ConsoleUI(component.Component): # If we have args, lets process them and quit # allow multiple commands split by ";" for arg in args.split(";"): - deferreds.append(self.do_command(arg.strip())) + deferreds.append(defer.maybeDeferred(self.do_command, arg.strip())) def on_complete(result): self.do_command("quit")