From 31452d16ecb42bd4c1256d09e39ea72eca929af0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 30 Aug 2008 23:00:38 +0530 Subject: Allow unprivileged users to parse jobuilds If we can't write to the logfile, don't :p --- slave/autotua/daemon/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'slave/autotua') 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): -- cgit v1.2.3-65-gdbad