From 9a5295e7c4bc4d3ba2c7aa284d129cb30d346e0d Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@endlessm.com> Date: Thu, 5 Mar 2020 16:10:54 +0200 Subject: [PATCH] Have Popen output as text streams. When passing universal_newlines=True to Popen stdout and stderr are text streams instead of bytes. Supported since Python 3.2. --- update_repos | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update_repos b/update_repos index d8c861a..ecc67b1 100755 --- a/update_repos +++ b/update_repos @@ -47,7 +47,8 @@ def system_exec(command, directory=None, show_output=True, ignore_error=False): directory = os.getcwd() try: - process = Popen(command, stdout=PIPE, stderr=PIPE, shell=True, cwd=directory) + process = Popen(command, stdout=PIPE, stderr=PIPE, shell=True, + cwd=directory, universal_newlines=True) (output, error) = process.communicate() output = output.strip() error = error.strip() -- GitLab