refactor(sentry): decouple agent import via string-match, rename predicate
Some checks failed
CI / Test (push) Successful in 2m46s
CI / Build (push) Successful in 1m35s
CI / Build-1 (push) Successful in 1m59s
CI / Build-2 (push) Successful in 1m35s
CI / Build-3 (push) Successful in 1m35s
CI / Build-4 (push) Successful in 1m33s
CI / Build-5 (push) Successful in 1m39s
CI / Lint (push) Failing after 2m33s
CI / Coverage (push) Successful in 2m56s
CI / Vet (push) Successful in 2m7s

This commit is contained in:
Deivid Soto 2026-05-27 17:03:26 +02:00
parent 9fe796f195
commit 9135332777
5 changed files with 36 additions and 23 deletions

View file

@ -1,6 +1,7 @@
package cmd
import (
"errors"
"fmt"
"os"
"os/exec"
@ -264,7 +265,10 @@ func runDaemonReload() error {
func stopDaemonByPID() error {
state, err := agent.LoadState()
if err != nil {
return err
if errors.Is(err, agent.ErrDaemonNotRunning) {
return err
}
return fmt.Errorf("read daemon state: %w", err)
}
return killPID(state.PID)
}

View file

@ -3,6 +3,7 @@
package cmd
import (
"errors"
"fmt"
"log"
"os"
@ -45,7 +46,10 @@ func startReloadWatcher(rc *ReloadableConfig) {
func sendReloadSignal() error {
state, err := agent.LoadState()
if err != nil {
return err
if errors.Is(err, agent.ErrDaemonNotRunning) {
return err
}
return fmt.Errorf("read daemon state: %w", err)
}
p, err := os.FindProcess(state.PID)
if err != nil {