fix: Enhance subprocess calls with UTF-8 encoding and error handling

This commit is contained in:
claudi 2026-01-30 09:41:31 +01:00
parent fb82d8d612
commit ad6e388dc8
2 changed files with 28 additions and 4 deletions

View file

@ -78,7 +78,12 @@ class WindowsBuilder:
]
print(f" Command: {' '.join(cmd)}")
result = subprocess.run(cmd, cwd=str(self.project_root))
result = subprocess.run(
cmd,
cwd=str(self.project_root),
encoding="utf-8",
errors="replace"
)
if result.returncode != 0:
print("❌ PyInstaller build failed")
@ -162,7 +167,11 @@ class WindowsBuilder:
]
print(f" Compiling WiX source...")
result = subprocess.run(candle_cmd)
result = subprocess.run(
candle_cmd,
encoding="utf-8",
errors="replace"
)
if result.returncode != 0:
print("❌ WiX compilation failed")
return False
@ -176,7 +185,11 @@ class WindowsBuilder:
]
print(f" Linking MSI installer...")
result = subprocess.run(light_cmd)
result = subprocess.run(
light_cmd,
encoding="utf-8",
errors="replace"
)
if result.returncode != 0:
print("❌ MSI linking failed")
return False
@ -279,7 +292,11 @@ class WindowsBuilder:
str(exe_path),
]
result = subprocess.run(cmd)
result = subprocess.run(
cmd,
encoding="utf-8",
errors="replace"
)
if result.returncode != 0:
print("❌ Code signing failed")
return False
@ -331,6 +348,7 @@ def sync_version() -> None:
[sys.executable, str(script_path)],
capture_output=True,
text=True,
encoding="utf-8",
)
if result.returncode != 0:
print(f"❌ Version sync failed: {result.stderr}")