From e1b09f269445cc650f5c1c63468cdc8bf1bcd908 Mon Sep 17 00:00:00 2001 From: John Garland Date: Sat, 29 Sep 2012 18:02:56 +0100 Subject: [PATCH] Only add quit to deluge-console args if it isn't already present This prevents an error from being raised due to trying to stop a reactor which is no longer running --- deluge/ui/console/commander.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deluge/ui/console/commander.py b/deluge/ui/console/commander.py index c4264c9df..4780256f5 100644 --- a/deluge/ui/console/commander.py +++ b/deluge/ui/console/commander.py @@ -119,10 +119,12 @@ class Commander: d = defer.succeed(None) # If we have args, lets process them and quit # allow multiple commands split by ";" - for arg in args.split(";"): - d.addCallback(do_command, arg.strip()) + commands = [arg.strip() for arg in args.split(';')] + for command in commands: + d.addCallback(do_command, command) - d.addCallback(do_command, "quit") + if "quit" not in commands and "exit" not in commands: + d.addCallback(do_command, "quit") # We need to wait for the rpcs in start() to finish before processing # any of the commands.