mirror of
https://github.com/GuDaStudio/codexmcp.git
synced 2026-02-12 02:47:43 +08:00
v0.4:测试Windows兼容性
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import queue
|
import queue
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
@@ -32,8 +33,11 @@ def run_shell_command(cmd: list[str]) -> Generator[str, None, None]:
|
|||||||
Yields:
|
Yields:
|
||||||
Output lines from the command
|
Output lines from the command
|
||||||
"""
|
"""
|
||||||
|
# On Windows, wrap command with cmd.exe to execute .cmd batch files
|
||||||
|
popen_cmd = ["cmd", "/c", *cmd] if os.name == "nt" else cmd
|
||||||
|
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
cmd,
|
popen_cmd,
|
||||||
shell=False, # Safer: no shell injection
|
shell=False, # Safer: no shell injection
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
|
|||||||
Reference in New Issue
Block a user