summaryrefslogtreecommitdiff
path: root/tools/indent.py
diff options
context:
space:
mode:
authorAndrew Cooks <acooks.at.bda@gmail.com>2024-04-09 15:39:14 +1000
committerAndrew Cooks <acooks.at.bda@gmail.com>2024-04-10 16:05:03 +1000
commite443644fdd1ff4f8de9ed487cc406dffcc83483b (patch)
tree24b4fc6f1a697f4bff6d852f7a83e6ea3efb8ffc /tools/indent.py
parent8cfa3b57e905ea2d5536c0c44b70a44cb11f4bb2 (diff)
tools/indent.py: fix encoded byte stream handling
Python subprocess communication now operates on bytes, not strings. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
Diffstat (limited to 'tools/indent.py')
-rwxr-xr-xtools/indent.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/indent.py b/tools/indent.py
index fe9eb7c252..dac7d3f04b 100755
--- a/tools/indent.py
+++ b/tools/indent.py
@@ -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: