Skip to content

[Bug] Windows 下从 WebUI 重启后新进程脱离 shell,Ctrl+C 不能中断 #9064

Description

@Rain-0x01-39

What happened / 发生了什么

_reboot() 调用 os.execv() 重启,但 Windows 没有 execve。CPython 实际执行 CreateProcessW + _exit():创建新进程后退出旧进程。结果新进程以新 PID 运行,脱离 shell 进程组,导致:

  • Shell 回到提示符,终端可继续输入
  • Ctrl+C 发给 shell(前台进程组),不发给新进程,无法中断
  • 只能手动找 PID 或关终端

Reproduce / 如何复现?

  1. uv run main.py
  2. 触发重启(如更新)
  3. Shell 恢复提示符,新进程仍在运行,Ctrl+C 无效

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

git(commit 89ec07a) uv, Windows 11 PowerShell 7

OS

Windows

Logs / 报错日志

Ctrl+C 不能中断
Image

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't workingfeature:updaterThe bug / feature is about astrbot updater system

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions