From 155c2ec2ef80d845ef8c495bf94d814f4398f970 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 18 Feb 2016 12:41:08 +0100 Subject: [PATCH] ctlmgr,worker: set PYTHONUNBUFFERED for subprocesses --- artiq/devices/ctlmgr.py | 5 ++++- artiq/master/worker.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/artiq/devices/ctlmgr.py b/artiq/devices/ctlmgr.py index c4873a66e..143bcfb38 100644 --- a/artiq/devices/ctlmgr.py +++ b/artiq/devices/ctlmgr.py @@ -81,9 +81,12 @@ class Controller: logger.info("Starting controller %s with command: %s", self.name, self.command) try: + env = os.environ.copy() + env["PYTHONUNBUFFERED"] = "1" self.process = await asyncio.create_subprocess_exec( *shlex.split(self.command), - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=env) asyncio.ensure_future( LogParser(self._get_log_source).stream_task( self.process.stdout)) diff --git a/artiq/master/worker.py b/artiq/master/worker.py index da591b140..0afc11c78 100644 --- a/artiq/master/worker.py +++ b/artiq/master/worker.py @@ -81,10 +81,13 @@ class Worker: if self.closed.is_set(): raise WorkerError("Attempting to create process after close") self.ipc = pipe_ipc.AsyncioParentComm() + env = os.environ.copy() + env["PYTHONUNBUFFERED"] = "1" await self.ipc.create_subprocess( sys.executable, "-m", "artiq.master.worker_impl", self.ipc.get_address(), str(log_level), - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=env) asyncio.ensure_future( LogParser(self._get_log_source).stream_task( self.ipc.process.stdout))