Skip to content

Commit 297d28f

Browse files
committed
Fix Windows CI stdout encoding
1 parent 7fc12e9 commit 297d28f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

tools/acceptance_check.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import argparse
44

5+
from common import configure_stdout
6+
57

68
GATES = {
79
"scope": "Изменены только нужные зоны и нет случайных правок вне задачи",
@@ -23,6 +25,7 @@ def build_parser() -> argparse.ArgumentParser:
2325

2426

2527
def main() -> int:
28+
configure_stdout()
2629
parser = build_parser()
2730
args = parser.parse_args()
2831
missing = [name for name in GATES if not getattr(args, name)]
@@ -40,4 +43,3 @@ def main() -> int:
4043

4144
if __name__ == "__main__":
4245
raise SystemExit(main())
43-

tools/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from dataclasses import dataclass
44
import os
55
from pathlib import Path
6+
import sys
67

78

89
ROOT_FILES = [
@@ -82,3 +83,10 @@ def append_section(path: Path, section: str) -> None:
8283
existing = read_text(path) if path.exists() else ""
8384
combined = existing.rstrip() + "\n\n" + section.strip() + "\n"
8485
write_text(path, combined)
86+
87+
88+
def configure_stdout() -> None:
89+
stream = sys.stdout
90+
if hasattr(stream, "reconfigure"):
91+
# Windows CI can default to cp1252 and crash on Cyrillic output.
92+
stream.reconfigure(encoding="utf-8", errors="backslashreplace")

0 commit comments

Comments
 (0)