chromium/chromium-94.0.4606.81-clang-format.patch

38 lines
1.4 KiB
Diff
Raw Normal View History

2021-10-08 15:51:53 +00:00
diff -up chromium-94.0.4606.81/buildtools/linux64/clang-format.clang-format-py3 chromium-94.0.4606.81/buildtools/linux64/clang-format
--- chromium-94.0.4606.81/buildtools/linux64/clang-format.clang-format-py3 2021-10-08 11:26:16.411861005 -0400
+++ chromium-94.0.4606.81/buildtools/linux64/clang-format 2021-10-08 11:32:16.005895508 -0400
@@ -12,9 +12,9 @@ def main():
args = sys.argv[1:]
inputfiles = [a for a in args if not a.startswith('-')]
- contents = ''
+ contents = b''
if '-' in args or not inputfiles:
- contents = sys.stdin.read()
+ contents = sys.stdin.buffer.read()
# Tarball builds may or may not have depot_tools in $PATH. In the former case,
# running 'clang-format' will call back into this script infinitely. Strip off
@@ -37,17 +37,17 @@ def main():
stdout, stderr = proc.communicate(input=contents)
# Ignore if clang-format fails. Eg: it may be too old to support C++14.
if proc.returncode == 0:
- sys.stdout.write(stdout)
- sys.stderr.write(stderr)
+ sys.stdout.buffer.write(stdout)
+ sys.stderr.buffer.write(stderr)
return 0
except OSError:
# Ignore if clang-format is not installed.
pass
# If any failure happens, continue with unformatted files.
- sys.stdout.write(contents)
+ sys.stdout.buffer.write(contents)
for inputfile in inputfiles:
- sys.stdout.write(open(inputfile).read())
+ sys.stdout.buffer.write(open(inputfile).read())
return 0