From 788f2f928c1d0099d3861553bf82e83169811a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Tue, 1 Nov 2022 22:09:38 +0100 Subject: [PATCH] Add reaper StartLocked --- sys/reaper/reaper_unix.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/reaper/reaper_unix.go b/sys/reaper/reaper_unix.go index 6c4f13b90..a6d6a1e77 100644 --- a/sys/reaper/reaper_unix.go +++ b/sys/reaper/reaper_unix.go @@ -101,6 +101,16 @@ func (m *Monitor) Start(c *exec.Cmd) (chan runc.Exit, error) { return ec, nil } +// StartLocked starts the command a registers the process with the reaper +func (m *Monitor) StartLocked(c *exec.Cmd) (chan runc.Exit, error) { + ec := m.Subscribe() + if err := c.Start(); err != nil { + m.Unsubscribe(ec) + return nil, err + } + return ec, nil +} + // Wait blocks until a process is signal as dead. // User should rely on the value of the exit status to determine if the // command was successful or not. -- 2.38.1