mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-07-17 04:17:21 +00:00
Makes the Stop button on the traces page actually stop running traces. Seven-phase implementation across provider HTTP, agent router, trace persistence, WS events, tool exec, i18n, and integration tests. - Provider HTTP+SSE ctx-aware: close socket on cancel via CtxBody wrapper - Router 2-phase abort: CAS state machine, 3s grace, force-mark fallback - Trace retry: 3 inline retries + 10-max retry queue, stale recovery 10min - trace.status WS event: real-time UI updates (invalidates query on receive) - Tool exec: process-group kill (SIGTERM→3s→SIGKILL), Rod page ctx watch - i18n: 6 abort toast variants in en/vi/zh - Integration: 9 scenarios, -race clean Fixes tenant-ctx loss in forceMarkTraceAborted and retry worker broadcast (caught by code-reviewer: C1/C2). Stale threshold intentionally 10min because start_time-based; last_span_at migration is a follow-up.
30 lines
936 B
Go
30 lines
936 B
Go
//go:build windows
|
|
|
|
package tools
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
// syscallSIGTERM / syscallSIGKILL are stub values on Windows.
|
|
// killProcessGroup ignores the signal and calls cmd.Process.Kill() directly.
|
|
const (
|
|
syscallSIGTERM = syscall.Signal(0x0f) // SIGTERM value; unused on Windows path
|
|
syscallSIGKILL = syscall.Signal(0x09) // SIGKILL value; unused on Windows path
|
|
)
|
|
|
|
// setProcessGroup is a no-op on Windows; process groups work differently and
|
|
// Setpgid is not supported by the Windows syscall layer.
|
|
func setProcessGroup(cmd *exec.Cmd) {}
|
|
|
|
// killProcessGroup falls back to terminating the direct child process on Windows.
|
|
// Process-tree kill on Windows requires the Job Objects API; single-process kill
|
|
// is sufficient for the current use case (host shell exec, no deep fork trees).
|
|
func killProcessGroup(cmd *exec.Cmd, _ syscall.Signal) error {
|
|
if cmd.Process == nil {
|
|
return nil
|
|
}
|
|
return cmd.Process.Kill()
|
|
}
|