Coding style.

Using asyncio coroutines for workers instead of threads.
This commit is contained in:
Andrew Hamilton 2016-03-09 10:47:09 +00:00
parent b2e087a9db
commit 4fa5b524d4
8 changed files with 103 additions and 101 deletions

View file

@ -79,14 +79,6 @@ class SandboxFs:
mount.umount()
self.overlay_mounts = []
def Popen(self, command, env=None):
full_command = _in_chroot(self.mount_point,
_in_directory(os.getcwd(), command))
return subprocess.Popen(full_command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
def run_command(self, command, env=None):
process = self.Popen(command, env)
stdout, stderr = process.communicate()
return stdout, stderr, process.returncode
def command(self, command, env=None):
return _in_chroot(self.mount_point,
_in_directory(os.getcwd(), command))