diff options
-rw-r--r-- | MgaRepo/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MgaRepo/util.py b/MgaRepo/util.py index 6d31399..635319d 100644 --- a/MgaRepo/util.py +++ b/MgaRepo/util.py @@ -20,15 +20,15 @@ def commands_getstatusoutput(cmd): """Return (status, output) of executing cmd in a shell.""" pipe = subprocess.Popen('{ ' + cmd + '; } 2>&1', stdin = subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines = True, shell = True) of = pipe.stdout.fileno() - text = '' + text = b'' pipe.stdin.close() while True: - text += os.read(of,8192).decode('utf8') + text += os.read(of,8192) status = pipe.poll() if status is not None or text == '': break if text[-1:] == '\n': text = text[:-1] - return status, text + return status, text.decode('utf8') def execcmd(*cmd, **kwargs): cmdstr = " ".join(cmd) |