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