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