From 7c60a4d8e8baa77b42789c041838fa82dd7d36f9 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 14 Mar 2025 18:30:22 +0900 Subject: helper: embed context on creation Signed-off-by: Ophestra --- helper/direct.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'helper/direct.go') diff --git a/helper/direct.go b/helper/direct.go index 9198952d..fcc7b4e8 100644 --- a/helper/direct.go +++ b/helper/direct.go @@ -16,7 +16,7 @@ type direct struct { *helperCmd } -func (h *direct) Start(ctx context.Context, stat bool) error { +func (h *direct) Start(stat bool) error { h.lock.Lock() defer h.lock.Unlock() @@ -26,15 +26,15 @@ func (h *direct) Start(ctx context.Context, stat bool) error { return errors.New("exec: already started") } - args := h.finalise(ctx, stat) + args := h.finalise(stat) h.Cmd.Args = append(h.Cmd.Args, args...) - return proc.Fulfill(ctx, h.Cmd, h.files, h.extraFiles) + return proc.Fulfill(h.ctx, h.Cmd, h.files, h.extraFiles) } // New initialises a new direct Helper instance with wt as the null-terminated argument writer. // Function argF returns an array of arguments passed directly to the child process. -func New(wt io.WriterTo, name string, argF func(argsFd, statFd int) []string) Helper { +func New(ctx context.Context, wt io.WriterTo, name string, argF func(argsFd, statFd int) []string) Helper { d := new(direct) - d.helperCmd = newHelperCmd(d, name, wt, argF, nil) + d.helperCmd = newHelperCmd(d, ctx, name, wt, argF, nil) return d } -- cgit v1.3.1