2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

ctlmgr/gui/master: start subprocesses in new pgroup

This only makes a difference on POSIX. It prevents subprocesses
from receiving the signals that the parent receives. For ctlmgr
and master is cuts down on spam on the console (KeyboardInterrupt
tracebacks from all controllers) and enforces that proper
termination is followed.

This does not help if the parent gets SIGKILL (subprocesses
may linger).
This commit is contained in:
Robert Jördens 2016-02-18 23:51:12 +01:00
parent 4bd5a55a2a
commit fef72506e4
3 changed files with 4 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class Controller:
self.process = await asyncio.create_subprocess_exec(
*shlex.split(self.command),
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
env=env, start_new_session=True)
asyncio.ensure_future(
LogParser(self._get_log_source).stream_task(
self.process.stdout))

View File

@ -116,7 +116,8 @@ class AppletDock(QDockWidgetCloseDetect):
)
logger.debug("starting command %s for %s", command, self.applet_name)
try:
await self.ipc.create_subprocess(*shlex.split(command))
await self.ipc.create_subprocess(*shlex.split(command),
start_new_session=True)
except:
logger.warning("Applet %s failed to start", self.applet_name,
exc_info=True)

View File

@ -87,7 +87,7 @@ class Worker:
sys.executable, "-m", "artiq.master.worker_impl",
self.ipc.get_address(), str(log_level),
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
env=env, start_new_session=True)
asyncio.ensure_future(
LogParser(self._get_log_source).stream_task(
self.ipc.process.stdout))