ActivityFactory: don't run which to check for rainbow

One less thing to do in the common activity startup path.
Also, which might not be available.
This commit is contained in:
Daniel Drake 2013-07-13 11:05:41 -06:00
parent 9e766327b3
commit 147d80aa78

View File

@ -223,12 +223,9 @@ class ActivityCreationHandler(GObject.GObject):
self._handle.object_id, self._handle.uri, self._handle.object_id, self._handle.uri,
self._handle.invited) self._handle.invited)
dev_null = file('/dev/null', 'w')
environment_dir = None environment_dir = None
rainbow_found = subprocess.call(['which', 'rainbow-run'], if os.path.exists('/etc/olpc-security') \
stdout=dev_null, stderr=dev_null) == 0 and os.access('/usr/bin/rainbow-run', os.X_OK):
use_rainbow = rainbow_found and os.path.exists('/etc/olpc-security')
if use_rainbow:
environment_dir = tempfile.mkdtemp() environment_dir = tempfile.mkdtemp()
command = ['sudo', '-E', '--', command = ['sudo', '-E', '--',
'rainbow-run', 'rainbow-run',