fix: Enhance subprocess calls with UTF-8 encoding and error handling
This commit is contained in:
parent
fb82d8d612
commit
ad6e388dc8
2 changed files with 28 additions and 4 deletions
|
|
@ -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}")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ import sys
|
|||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
# Enable UTF-8 output on Windows
|
||||
if sys.platform == "win32":
|
||||
import io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
||||
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8")
|
||||
|
||||
# Import shared version utilities
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "build" / "scripts"))
|
||||
from version_utils import get_current_version, get_project_root
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue