diff --git a/gui.py b/gui.py index c9f3fea..1ff03ef 100644 --- a/gui.py +++ b/gui.py @@ -399,18 +399,14 @@ def index(): print("DEBUG: invoking PowerShell SaveFileDialog...") - # 使用 run.io_bound 在线程中执行,避免阻塞 UI - def run_ps(): - result = subprocess.run( - ["powershell", "-Command", ps_script], - capture_output=True, - text=True, - startupinfo=startupinfo - ) - return result.stdout.strip() - - from nicegui import run - save_path = await run.io_bound(run_ps) + # 在 native 模式下直接同步执行,不使用 run.io_bound() + result = subprocess.run( + ["powershell", "-Command", ps_script], + capture_output=True, + text=True, + startupinfo=startupinfo + ) + save_path = result.stdout.strip() if save_path: print(f"DEBUG: PowerShell returned path: {save_path}")