From 284d49e1cdca63cde4114c123815e9f0b7e8dbdb Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sun, 2 May 2021 18:31:50 +0200 Subject: [PATCH] - use subprocess.Popen instead of os.popen which is now text only --- TLD_Builder/chroot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TLD_Builder/chroot.py b/TLD_Builder/chroot.py index 8acd58d..b790e51 100644 --- a/TLD_Builder/chroot.py +++ b/TLD_Builder/chroot.py @@ -28,7 +28,12 @@ def command_sh(cmd): % (config.sudo_chroot_wrapper, config.chroot, quote(cmd)) def popen(cmd, user = "builder", mode = "r"): - f = os.popen(command(cmd, user), mode) + if mode == "r": + p = subprocess.Popen(command(cmd, user), shell=True, stdout=subprocess.PIPE, close_fds=True) + f = p.stdout + else: + p = subprocess.Popen(command(cmd, user), shell=True, stdin=subprocess.PIPE, close_fds=True) + f = p.stdin return f def run(cmd, user = "builder", logfile = None, logstdout = None): -- 2.46.0