summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-12-27 18:18:20 +0100
committermathieui <mathieui@mathieui.net>2012-12-27 18:18:20 +0100
commitf2caca5f23542519ecaaae7c65329476073613cb (patch)
treec600f030a616545a1f72e71e0a0f1dd2cc730866
parent97c66b42c306f44f8085ebcb5d46eadc5a50b3b5 (diff)
downloadpoezio-f2caca5f23542519ecaaae7c65329476073613cb.tar.gz
poezio-f2caca5f23542519ecaaae7c65329476073613cb.tar.bz2
poezio-f2caca5f23542519ecaaae7c65329476073613cb.tar.xz
poezio-f2caca5f23542519ecaaae7c65329476073613cb.zip
Fix #2153
-rwxr-xr-xsrc/daemon.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/daemon.py b/src/daemon.py
index 08cf480f..717dfd63 100755
--- a/src/daemon.py
+++ b/src/daemon.py
@@ -35,9 +35,10 @@ class Executor(threading.Thread):
WARNING: Be careful to properly escape what is untrusted by using
pipes.quote (or shlex.quote with python 3.3) for example.
"""
- def __init__(self, command):
+ def __init__(self, command, remote=False):
threading.Thread.__init__(self)
self.command = command
+ self.remote = remote
# check for > or >> special case
self.filename = None
self.redirection_mode = 'w'
@@ -57,7 +58,14 @@ class Executor(threading.Thread):
except (OSError, IOError) as e:
log.error('Could not open redirection file: %s (%s)' % (self.filename, e,))
return
- subprocess.call(self.command, stdout=stdout)
+ try:
+ subprocess.call(self.command, stdout=stdout)
+ except:
+ import traceback
+ if self.remote:
+ print(traceback.format_exc())
+ else:
+ log.error('Could not execute %s:\n%s', self.command, traceback.format_exc())
def main():
while True:
@@ -65,7 +73,7 @@ def main():
if line == '':
break
command = shlex.split(line)
- e = Executor(command)
+ e = Executor(command, remote=True)
e.start()
if __name__ == '__main__':