Skip to content

Commit

Permalink
Fix encoding error in alibuild_helpers.cmd.execute (#734)
Browse files Browse the repository at this point in the history
Add an encoding parameter, if supported, to match getstatusoutput and getoutput.
  • Loading branch information
TimoWilken authored Dec 6, 2021
1 parent b8139bf commit 969085a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion alibuild_helpers/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def getstatusoutput(command):


def execute(command, printer=debug):
kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
popen = Popen(command, shell=is_string(command), stdout=PIPE,
universal_newlines=True)
universal_newlines=True, **kwargs)
lines_iterator = iter(popen.stdout.readline, "")
for line in lines_iterator:
if not line: break
Expand Down

0 comments on commit 969085a

Please sign in to comment.