From 3f91bca3a365d41d678c1a7fc71f5de27927f1ca Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 14 Apr 2026 19:25:59 +0100 Subject: [PATCH] fix(process): add missing processHandle/currentPID helpers + trim daemon payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - process_handle.go: new file adding processHandle(pid) wrapping os.FindProcess and currentPID() wrapping os.Getpid — referenced by pidfile.go but never defined, breaking the build on dev - pkg/api/provider.go: drop daemonEventPayload entries for entry.Config and entry.StartedAt — fields don't exist on DaemonEntry (which has Started time.Time) Unblocks go-process dev build + tests (10s root, 0.9s exec, 7s api). Co-Authored-By: Virgil --- pkg/api/provider.go | 16 +++++++--------- process_handle.go | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 process_handle.go diff --git a/pkg/api/provider.go b/pkg/api/provider.go index 8117721..ecf5561 100644 --- a/pkg/api/provider.go +++ b/pkg/api/provider.go @@ -1024,15 +1024,13 @@ func (p *ProcessProvider) emitEvent(channel string, data any) { func daemonEventPayload(entry process.DaemonEntry) map[string]any { return map[string]any{ - "code": entry.Code, - "daemon": entry.Daemon, - "pid": entry.PID, - "health": entry.Health, - "project": entry.Project, - "binary": entry.Binary, - "config": entry.Config, - "started": entry.Started, - "startedAt": entry.StartedAt, + "code": entry.Code, + "daemon": entry.Daemon, + "pid": entry.PID, + "health": entry.Health, + "project": entry.Project, + "binary": entry.Binary, + "started": entry.Started, } } diff --git a/process_handle.go b/process_handle.go new file mode 100644 index 0000000..a74af40 --- /dev/null +++ b/process_handle.go @@ -0,0 +1,17 @@ +package process + +import "os" + +// processHandle returns an os.Process for the given PID. +// +// proc, err := processHandle(12345) +func processHandle(pid int) (*os.Process, error) { + return os.FindProcess(pid) +} + +// currentPID returns the calling process ID. +// +// pid := currentPID() +func currentPID() int { + return os.Getpid() +}