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.invited)
dev_null = file('/dev/null', 'w')
environment_dir = None
rainbow_found = subprocess.call(['which', 'rainbow-run'],
stdout=dev_null, stderr=dev_null) == 0
use_rainbow = rainbow_found and os.path.exists('/etc/olpc-security')
if use_rainbow:
if os.path.exists('/etc/olpc-security') \
and os.access('/usr/bin/rainbow-run', os.X_OK):
environment_dir = tempfile.mkdtemp()
command = ['sudo', '-E', '--',
'rainbow-run',