Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/code_run_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def _d(b):
try: return b.decode()
except: return b.decode('gbk', 'replace')
def _run(*a, **k):
if os.name == 'nt': k['creationflags'] = (k.get('creationflags') or 0) | 0x08000000
t = k.pop('text', 0) | k.pop('universal_newlines', 0)
enc = k.pop('encoding', None)
k.pop('errors', None)
Expand Down
3 changes: 2 additions & 1 deletion ga.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def code_run(code, code_type="python", timeout=60, cwd=None, code_cwd=None, stop
tmp_file.close()
cmd = [sys.executable, "-X", "utf8", "-u", tmp_path]
elif code_type in ["powershell", "bash", "sh", "shell", "ps1", "pwsh"]:
if os.name == 'nt': cmd = ["powershell", "-NoProfile", "-NonInteractive", "-Command", code]
if os.name == 'nt':
cmd = ["powershell", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", code]
else: cmd = ["bash", "-c", code]
else:
return {"status": "error", "msg": f"不支持的类型: {code_type}"}
Expand Down