Files

38 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: T-101
title: 实现启动、registry、Wait 和 profile 占用检测
phase: 1
deps: [T-003]
status: DONE
created: 2026-07-22
owner: codex
---
## 需求与背景
Chub 需要在启动真实 Windows 进程前建立本进程实例 registry,防止并发启动相同 user data dir,并在浏览器退出后及时释放占用。
## 方案与边界
- `internal/platform/browser/Launcher` 通过 `CommandRunner` 启动参数数组。
- profile registry 以规范化 user data dir 为 key,支持 pending reservation 和重复启动错误。
- `ProcessHandle.Wait` 支持 context 取消观察,但取消不会终止浏览器。
- 进程退出后后台 monitor 释放 registry;`InspectProfile` 只报告本进程 registry。
- 本任务不识别外部进程、不强制关闭、不管理 Job Object。
## 验收要点
- 两个不同 profile 可并行启动。
- 同 profile 第二次启动返回 `ErrProfileOccupied` 并包含 PID。
- 进程退出后 profile 可再次启动。
- Wait 取消不会终止进程。
- `go test ./...`、`go vet ./...` 通过。
## 执行记录
- 状态:DONE
- 变更:新增可注入 CommandRunner、OS runner、profile registry、tracked process 和 fake runner 回归测试。
- 验证:`gofmt`、`go test ./...`、`go vet ./...` 均通过。
- 阻塞:无。
- 残余风险:registry 只代表 Chub 当前进程;外部 profile 占用需 T-102 处理。