% (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):