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:
parent
afcbea305e
commit
3f91bca3a3
2 changed files with 24 additions and 9 deletions
|
|
@ -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
17
process_handle.go
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue