mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
fix(win): use PowerShell instead of cmd.exe
This commit is contained in:
@@ -108,12 +108,13 @@ SAFETY:
|
||||
|
||||
if self._IS_WIN:
|
||||
env["PYTHONIOENCODING"] = "utf-8"
|
||||
# Use PowerShell so that LLM-generated commands can use
|
||||
# Select-String, Select-Object, curl (Invoke-WebRequest alias),
|
||||
# etc. instead of Unix-only head/grep/tail.
|
||||
wrapped = (
|
||||
"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; "
|
||||
f"{command}; exit $LASTEXITCODE"
|
||||
)
|
||||
result = subprocess.run(
|
||||
["powershell.exe", "-NoProfile", "-NonInteractive",
|
||||
"-ExecutionPolicy", "Bypass", "-Command", command],
|
||||
"-ExecutionPolicy", "Bypass", "-Command", wrapped],
|
||||
cwd=self.cwd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
|
||||
Reference in New Issue
Block a user