Skip to content

Commit

Permalink
proc: set pgrp in spawned daemon processes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Jun 13, 2022
1 parent 708e0a9 commit d132caa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dvc_task/proc/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def spawn(cls, *args, **kwargs) -> Optional[int]:
Returns: The spawned process PID.
"""
proc = mp.Process(
proc = _DaemonProcess(
target=cls._spawn,
args=args,
kwargs=kwargs,
Expand All @@ -203,3 +203,10 @@ def spawn(cls, *args, **kwargs) -> Optional[int]:
def _spawn(cls, *args, **kwargs):
with cls(*args, **kwargs):
pass


class _DaemonProcess(mp.Process):
def run(self):
if os.name != "nt":
os.setpgid(0, 0) # pylint: disable=no-member
super().run()

0 comments on commit d132caa

Please sign in to comment.