fix(process): add missing processHandle/currentPID helpers + trim daemon payload

- 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 <virgil@lethean.io>
This commit is contained in:
Snider 2026-04-14 19:25:59 +01:00
parent afcbea305e
commit 3f91bca3a3
2 changed files with 24 additions and 9 deletions

View file

@ -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,
}
}

17
process_handle.go Normal file
View file

@ -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()
}