Skip to content

Commit

Permalink
Enhance error handling and platform-specific command execution in Pyt…
Browse files Browse the repository at this point in the history
…hon executor
  • Loading branch information
polischuks committed Feb 15, 2025
1 parent 8c1e2fe commit 5ee2496
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hstest/testing/execution/process/python_executor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import os
import sys
from hstest.testing.execution.process_executor import ProcessExecutor
from hstest.testing.execution.searcher.python_searcher import PythonSearcher

Expand All @@ -9,4 +11,9 @@ def __init__(self, source_name: str | None = None) -> None:
super().__init__(PythonSearcher().find(source_name))

def _execution_command(self, *args: str):
return ["python", "-u", self.runnable.file, *list(args)]
cmd = ["python"]
if sys.platform == 'win32':
# Set UTF-8 encoding for stdin/stdout on Windows
cmd.extend(["-X", "utf8"])
cmd.extend(["-u", self.runnable.file, *list(args)])
return cmd

0 comments on commit 5ee2496

Please sign in to comment.