summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garland <johnnybg+deluge@gmail.com>2012-03-02 12:54:33 +1100
committerJohn Garland <johnnybg+deluge@gmail.com>2012-03-02 13:03:01 +1100
commitbe75d5021b672146f08c96178a9f347541b74f14 (patch)
tree58adf5360ad62ff5c946e81f616b876a91eae196
parentb0029517eb7a0f122adfc6c8231bf404d277623b (diff)
downloaddeluge-be75d5021b672146f08c96178a9f347541b74f14.tar.gz
deluge-be75d5021b672146f08c96178a9f347541b74f14.tar.bz2
deluge-be75d5021b672146f08c96178a9f347541b74f14.zip
Execute: log stdout/stderr when command fails
-rw-r--r--deluge/plugins/execute/execute/core.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/deluge/plugins/execute/execute/core.py b/deluge/plugins/execute/execute/core.py
index 9a4b3422b..a1df19ea5 100644
--- a/deluge/plugins/execute/execute/core.py
+++ b/deluge/plugins/execute/execute/core.py
@@ -36,7 +36,7 @@
import os
import time
import hashlib
-from twisted.internet.utils import getProcessValue
+from twisted.internet.utils import getProcessOutputAndValue
from deluge.log import LOG as log
from deluge.plugins.pluginbase import CorePluginBase
@@ -110,9 +110,14 @@ class Core(CorePluginBase):
log.debug("[execute] Running commands for %s", event)
- def log_error(exit_code, command):
+ def log_error(result, command):
+ (stdout, stderr, exit_code) = result
if exit_code:
log.warn("[execute] command '%s' failed with exit code %d", command, exit_code)
+ if stdout:
+ log.warn("[execute] stdout: %s", stdout)
+ if stderr:
+ log.warn("[execute] stderr: %s", stderr)
# Go through and execute all the commands
for command in self.config["commands"]:
@@ -120,7 +125,7 @@ class Core(CorePluginBase):
command = os.path.expandvars(command[EXECUTE_COMMAND])
command = os.path.expanduser(command)
log.debug("[execute] running %s", command)
- d = getProcessValue(command, (torrent_id, torrent_name, save_path), env=os.environ)
+ d = getProcessOutputAndValue(command, (torrent_id, torrent_name, save_path), env=os.environ)
d.addCallback(log_error, command)
def disable(self):