1
0
mirror of https://github.com/GuDaStudio/codexmcp.git synced 2026-02-05 02:00:24 +08:00
This commit is contained in:
GuDaStudio
2025-11-10 18:53:16 +08:00
parent d429757967
commit 4f746a757b

View File

@@ -38,10 +38,13 @@ def run_shell_command(cmd: list[str]) -> Generator[str, None, None]:
# user prompts containing quotes/newlines aren't reinterpreted as shell syntax.
popen_cmd = cmd
codex_path = shutil.which('codex') or None # 替换运行路径
if codex_path is not None:
codex_path = shutil.which('codex') or cmd[0]
popen_cmd[0] = codex_path
if os.name == "nt" and codex_path.lower().endswith((".cmd", ".bat")):
from subprocess import list2cmdline
popen_cmd = ["cmd.exe", "/s", "/c", list2cmdline(cmd)]
process = subprocess.Popen(
popen_cmd,
shell=False, # Safer: no shell injection