From: Marcin Krol Date: Sun, 2 May 2021 16:31:50 +0000 (+0200) Subject: - use subprocess.Popen instead of os.popen which is now text only X-Git-Url: https://git.tld-linux.org/?p=tld-builder.git;a=commitdiff_plain;h=284d49e1cdca63cde4114c123815e9f0b7e8dbdb - use subprocess.Popen instead of os.popen which is now text only --- 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):