summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-04-18 17:06:58 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-04-18 17:06:58 +0200
commit353480db41bddb9e8827cd55009de41b5b864835 (patch)
tree81be62b9afac1b213529c6bad8f89d8fc93e4853
parentf3f5068e99dd3a915defd57d9fc276a26164b1ff (diff)
downloadpython-linuxnamespaces-353480db41bddb9e8827cd55009de41b5b864835.tar.gz
examples/cgroup.py: we should pass Delegate=true
-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)