]> TLD Linux GIT Repositories - tld-builder.git/commitdiff
- use subprocess.Popen instead of os.popen which is now text only
authorMarcin Krol <hawk@tld-linux.org>
Sun, 2 May 2021 16:31:50 +0000 (18:31 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Sun, 2 May 2021 16:31:50 +0000 (18:31 +0200)
TLD_Builder/chroot.py

index 8acd58d10abd628384e8b39960ec30cca3dcf031..b790e51dbbad431885d46b3ff2f25d59de526448 100644 (file)
@@ -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):