From 353480db41bddb9e8827cd55009de41b5b864835 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 18 Apr 2024 17:06:58 +0200 Subject: examples/cgroup.py: we should pass Delegate=true --- examples/cgroup.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/cgroup.py b/examples/cgroup.py index 1c94d32..8f81a85 100755 --- a/examples/cgroup.py +++ b/examples/cgroup.py @@ -99,7 +99,10 @@ async def start_transient_unit_with_ravel(pid: int) -> None: bus["org.freedesktop.systemd1"]["/org/freedesktop/systemd1"] .get_interface("org.freedesktop.systemd1.Manager") .StartTransientUnit( - f"cgroup-{pid}.scope", "fail", [("PIDs", ("au", [pid]))], [] + f"cgroup-{pid}.scope", + "fail", + [("PIDs", ("au", [pid])), ("Delegate", ("b", True))], + [], ) )[0] result = await wait(scope_job) @@ -132,7 +135,15 @@ def main() -> None: ) sys.exit(1) os.execvp( - "systemd-run", ["systemd-run", "--user", "--scope"] + sys.argv, + "systemd-run", + [ + "systemd-run", + "--user", + "--scope", + "--property", + "Delegate=true", + *sys.argv, + ], ) print("Error: Failed to re-execute myself inside systemd-run.") sys.exit(1) -- cgit v1.2.3