From b32099c4f1c9c3f7ab24bec2391d466d7850d1d9 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Mon, 15 Aug 2022 06:42:19 +0200 Subject: [PATCH] binfmt.py: use exec.run_root_cmd() --- binfmt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binfmt.py b/binfmt.py index 7c536fc..fe8fea2 100644 --- a/binfmt.py +++ b/binfmt.py @@ -2,8 +2,8 @@ import os import logging -import subprocess +from exec import run_root_cmd from utils import mount @@ -63,7 +63,7 @@ def register(arch): # Register in binfmt_misc logging.info(f"Registering qemu binfmt ({arch})") - subprocess.run(["sh", "-c", 'echo "' + code + '" > ' + register + ' 2>/dev/null']) + run_root_cmd(["sh", "-c", f'echo "{code}" > {register} 2>/dev/null']) if not is_registered(arch): logging.debug(f'binfmt line: {code}') raise Exception(f'Failed to register qemu-user for {arch} with binfmt_misc, {binfmt}/{info["name"]} not found') @@ -74,4 +74,4 @@ def unregister(arch): if not os.path.exists(binfmt_file): return logging.info(f"Unregistering qemu binfmt ({arch})") - subprocess.run(["sh", "-c", "echo -1 > " + binfmt_file]) + run_root_cmd(["sh", "-c", f"echo -1 > {binfmt_file}"])