diff options
-rw-r--r-- | slave/autotua/daemon/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/slave/autotua/daemon/__init__.py b/slave/autotua/daemon/__init__.py index 9e52fb0..50f28f9 100644 --- a/slave/autotua/daemon/__init__.py +++ b/slave/autotua/daemon/__init__.py @@ -6,7 +6,7 @@ # Immortal lh! # -import subprocess +import os, subprocess from .. import config class Spawn(object): @@ -33,9 +33,11 @@ class Spawn(object): # stderr goes to stdout # stdout goes to self.logfile if chroot: - self.command = 'chroot \"%s\" /bin/bash -c \'%s\' 3>&2 2>&1 | tee -a \"%s\"' % (chroot, command, self.logfile) + self.command = 'chroot \"%s\" /bin/bash -c \'%s\' 3>&2 2>&1 ' % (chroot, command) else: - self.command = '/bin/bash -c \'%s\' 3>&2 2>&1 | tee -a \"%s\"' % (command, self.logfile) + self.command = '/bin/bash -c \'%s\' 3>&2 2>&1 ' % command + if os.access(self.logfile, os.W_OK): + self.command += '| tee -a \"%s\"' % self.logfile self.process = self._init() def _init(self): |