From: Andrew Cooks Date: Tue, 9 Apr 2024 05:39:14 +0000 (+1000) Subject: tools/indent.py: fix encoded byte stream handling X-Git-Tag: base_10.1~194^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F15710%2Fhead;p=mirror%2Ffrr.git tools/indent.py: fix encoded byte stream handling Python subprocess communication now operates on bytes, not strings. Signed-off-by: Andrew Cooks --- 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: