Put a hole in the sandbox once. Not once per worker.

This commit is contained in:
Andrew Hamilton 2016-03-12 23:16:52 +00:00
parent ccdd89fa28
commit 6455271aa0
3 changed files with 21 additions and 17 deletions

View file

@ -31,14 +31,9 @@ class Worker:
@asyncio.coroutine
def create_process(self):
if self.sandbox is None:
command = [__file__]
else:
cache_path = os.path.join(os.getcwd(), tools.CACHE_PATH)
cache_mount = self.sandbox.mount_point + cache_path
subprocess.check_call(["sudo", "mount", "--bind", cache_path,
cache_mount])
command = self.sandbox.command([__file__])
command = [__file__]
if self.sandbox is not None:
command = self.sandbox.command(command)
create = asyncio.create_subprocess_exec(
*command, stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)