diff --git a/src/commands/cmd_watch.go b/src/commands/cmd_watch.go index efa4972..7c78587 100644 --- a/src/commands/cmd_watch.go +++ b/src/commands/cmd_watch.go @@ -28,13 +28,17 @@ func NewWatchCmd(history *models.History) *cobra.Command { if err == nil { pids := strings.Fields(string(out)) myPid := os.Getpid() + otherPids := []string{} for _, pidStr := range pids { pid, err := strconv.Atoi(pidStr) if err == nil && pid != myPid { - log.Warn().Msg("kcm daemon is already running. Exiting to avoid duplicate daemons.") - os.Exit(1) + otherPids = append(otherPids, pidStr) } } + if len(otherPids) > 0 { + log.Warn().Strs("pids", otherPids).Msg("kcm daemon is already running. Exiting to avoid duplicate daemons.") + os.Exit(1) + } } // Set log file path since we are daemonizing