Skip to content

Commit

Permalink
Merge pull request #15710 from acooks-at-bda/bugfix/fix-indent-byte-h…
Browse files Browse the repository at this point in the history
…andling

tools/indent.py: fix encoded byte stream handling
  • Loading branch information
donaldsharp authored Apr 11, 2024
2 parents 0176f62 + e443644 commit 5139ce8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/indent.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def wrap_file(fn):
ci = subprocess.Popen(
["clang-format"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
stdout, ign = ci.communicate(text)
stdout, ign = ci.communicate(text.encode("utf-8"))
ci.wait()
if ci.returncode != 0:
raise IOError("clang-format returned %d" % (ci.returncode))

# remove the bits we inserted above
final = clean_re.sub("", stdout)
final = clean_re.sub("", stdout.decode("utf-8"))

tmpname = fn + ".indent"
with open(tmpname, "w") as ofd:
Expand Down

0 comments on commit 5139ce8

Please sign in to comment.