From a5d53c0a7bf54711ec18a71b0667f37070f25989 Mon Sep 17 00:00:00 2001 From: Jip-Hop <2871973+Jip-Hop@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:12:34 +0100 Subject: [PATCH] Properly pass exit code from exec --- jlmkr.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/jlmkr.py b/jlmkr.py index 1dc2e11..6bb588c 100755 --- a/jlmkr.py +++ b/jlmkr.py @@ -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 )