Skip to content

Commit 92890bd

Browse files
committed
Process spawner - process group
This change will spawn the new subprocess task into its own process group. It will give us more control over the signal handling since the signals won't be propagated to the subprocess any more. Signed-off-by: Jan Richter <jarichte@redhat.com>
1 parent 34f317a commit 92890bd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

avocado/plugins/spawners/process.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ async def spawn_task(self, runtime_task):
5353

5454
# pylint: disable=E1133
5555
try:
56+
preexec_fn = None
57+
if "setpgrp" in dir(os):
58+
preexec_fn = os.setpgrp
5659
proc = await asyncio.create_subprocess_exec(
5760
runner,
5861
*args,
5962
stdout=asyncio.subprocess.DEVNULL,
6063
stderr=asyncio.subprocess.DEVNULL,
6164
env=get_python_path_env_if_egg(),
65+
preexec_fn=preexec_fn
6266
)
6367
except (FileNotFoundError, PermissionError):
6468
return False

0 commit comments

Comments
 (0)