Properly pass exit code from exec

This commit is contained in:
Jip-Hop 2024-02-07 17:12:34 +01:00
parent 3940c87fdf
commit a5d53c0a7b
1 changed files with 15 additions and 14 deletions

View File

@ -223,20 +223,21 @@ def exec_jail(jail_name, cmd, args):
"""
Execute a command in the jail with given name.
"""
subprocess.run(
[
"systemd-run",
"--machine",
jail_name,
"--quiet",
"--pipe",
"--wait",
"--collect",
"--service-type=exec",
cmd,
]
+ args,
check=True,
sys.exit(
subprocess.run(
[
"systemd-run",
"--machine",
jail_name,
"--quiet",
"--pipe",
"--wait",
"--collect",
"--service-type=exec",
cmd,
]
+ args
).returncode
)