chore: fix npm run lint not working on Windows (#42905)

* fix: fixed the `npm run lint` not working on Windows.

* chore: more fixes for lint on Windows

* chore: revert change to patch linting

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
This commit is contained in:
trop[bot] 2024-07-16 12:32:12 +02:00 committed by GitHub
parent ef4896b37f
commit c4d9e79021
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 10 deletions

View file

@ -134,6 +134,7 @@ def run_clang_format_diff(args, file_name):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
encoding='utf-8',
shell=True) as proc:
outs = list(proc.stdout.readlines())
errs = list(proc.stderr.readlines())
@ -186,10 +187,7 @@ def colorize(diff_lines):
def print_diff(diff_lines, use_color):
if use_color:
diff_lines = colorize(diff_lines)
if sys.version_info[0] < 3:
sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
else:
sys.stdout.writelines(diff_lines)
sys.stdout.writelines(diff_lines)
def print_trouble(prog, message, use_colors):