Skip to content

Commit

Permalink
ctlmgr/gui/master: start subprocesses in new pgroup
Browse files Browse the repository at this point in the history
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).
jordens committed Feb 18, 2016
1 parent 4bd5a55 commit fef7250
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion artiq/devices/ctlmgr.py
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ async def launcher(self):
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))
3 changes: 2 additions & 1 deletion artiq/gui/applets.py
Original file line number Diff line number Diff line change
@@ -116,7 +116,8 @@ async def start(self):
)
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)
2 changes: 1 addition & 1 deletion artiq/master/worker.py
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ async def _create_process(self, log_level):
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))

0 comments on commit fef7250

Please sign in to comment.