]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools/indent.py: fix encoded byte stream handling 15710/head
authorAndrew Cooks <acooks.at.bda@gmail.com>
Tue, 9 Apr 2024 05:39:14 +0000 (15:39 +1000)
committerAndrew Cooks <acooks.at.bda@gmail.com>
Wed, 10 Apr 2024 06:05:03 +0000 (16:05 +1000)
Python subprocess communication now operates on bytes, not strings.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
tools/indent.py

index fe9eb7c2526b382dce31e043e65f4dc20bc1341c..dac7d3f04b66c5baee050982c803d8bb81b7e748 100755 (executable)
@@ -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: