summaryrefslogtreecommitdiff
path: root/examples/cgroup.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cgroup.py')
-rwxr-xr-xexamples/cgroup.py15
1 files changed, 13 insertions, 2 deletions
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)