feat: add scoped browser stop and job control
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: T-103
|
||||
title: 实现优雅关闭、强制关闭和 Job Object 进程树
|
||||
phase: 1
|
||||
deps: [T-102]
|
||||
status: DONE
|
||||
created: 2026-07-22
|
||||
owner: codex
|
||||
---
|
||||
|
||||
## 需求与背景
|
||||
|
||||
浏览器是多进程架构,Chub 必须提供实例级关闭能力,同时避免通过进程名称影响用户的其他 Chrome/Edge。
|
||||
|
||||
## 方案与边界
|
||||
|
||||
- `Launcher.StopProfile` 只定位本 registry 中的规范化 user data dir。
|
||||
- Windows 优雅关闭向对应 PID 的窗口发送 `WM_CLOSE`。
|
||||
- Windows 启动进程加入 Job Object;强制关闭调用 `TerminateJobObject`,覆盖该实例的子进程树。
|
||||
- 非 Windows 保留显式降级:仅 force 使用进程 Kill,graceful 返回 unsupported。
|
||||
- 外部未注册进程不提供 Stop 接口。
|
||||
|
||||
## 验收要点
|
||||
|
||||
- 优雅关闭与强制关闭传递正确模式。
|
||||
- 未注册 profile 返回 `ErrInstanceNotFound`。
|
||||
- 取消 Stop 不执行关闭动作。
|
||||
- Windows Job Object 和窗口消息代码可编译,现有测试通过。
|
||||
- `go test ./...`、`go vet ./...` 通过。
|
||||
|
||||
## 执行记录
|
||||
|
||||
- 状态:DONE
|
||||
- 变更:新增实例 StopProfile、RunnerProcessController、Windows Job Object、WM_CLOSE 和非 Windows 降级实现。
|
||||
- 验证:`gofmt`、`go test ./...`、`go vet ./...` 均通过。
|
||||
- 阻塞:无。
|
||||
- 残余风险:真实 Chrome/Edge 窗口优雅关闭、子进程回收和强制关闭需 T-104 Windows smoke 验证。
|
||||
Reference in New Issue
Block a user