mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-11 03:23:50 +08:00
fix(merge): 修复master合并后的编译和测试问题
在重构代码后合并master分支时需要的适配:
1. **接口定义恢复** (executor.go)
- 添加 commandRunner 和 processHandle 接口
- 实现 realCmd 和 realProcess 适配器
- 添加 newCommandRunner 测试钩子
2. **TaskResult扩展** (config.go)
- 添加 LogPath 字段支持日志路径跟踪
- 在 generateFinalOutput 中输出 LogPath
3. **原子变量适配** (main.go, executor.go)
- forceKillDelay 从int改为 atomic.Int32
- 添加测试钩子: cleanupLogsFn, signalNotifyFn, signalStopFn
- 添加 stdout 关闭原因常量
4. **功能函数添加**
- runStartupCleanup: 启动时清理旧日志
- runCleanupMode: --cleanup 模式处理
- forceKillTimer 类型和 terminateCommand 函数
- terminateProcess nil 安全检查
5. **测试适配** (logger_test.go, main_test.go)
- 将 *exec.Cmd 包装为 &realCmd{cmd}
- 修复 forwardSignals 等函数调用
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2002,7 +2002,7 @@ func TestRunCodexTask_SignalHandling(t *testing.T) {
|
||||
func TestForwardSignals_ContextCancel(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
forwardSignals(ctx, &exec.Cmd{}, func(string) {})
|
||||
forwardSignals(ctx, &realCmd{cmd: &exec.Cmd{}}, func(string) {})
|
||||
cancel()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
@@ -3070,13 +3070,13 @@ func TestRunForwardSignals(t *testing.T) {
|
||||
t.Skip("sleep command not available on Windows")
|
||||
}
|
||||
|
||||
cmd := exec.Command("sleep", "5")
|
||||
if err := cmd.Start(); err != nil {
|
||||
execCmd := exec.Command("sleep", "5")
|
||||
if err := execCmd.Start(); err != nil {
|
||||
t.Skipf("unable to start sleep command: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
_ = cmd.Process.Kill()
|
||||
cmd.Wait()
|
||||
_ = execCmd.Process.Kill()
|
||||
execCmd.Wait()
|
||||
}()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -3099,6 +3099,7 @@ func TestRunForwardSignals(t *testing.T) {
|
||||
|
||||
var mu sync.Mutex
|
||||
var logs []string
|
||||
cmd := &realCmd{cmd: execCmd}
|
||||
forwardSignals(ctx, cmd, func(msg string) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user