From 8492239cba18c66c2b6dc76eaf3314f11b38b10b Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Wed, 25 Sep 2024 14:00:30 +0900 Subject: helper/args: simplify argument parsing and eliminate excess memory copies Signed-off-by: Ophestra Umiker --- helper/helper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'helper/helper.go') diff --git a/helper/helper.go b/helper/helper.go index 6f529229..5488ec50 100644 --- a/helper/helper.go +++ b/helper/helper.go @@ -19,7 +19,6 @@ var ( // Helper wraps *exec.Cmd and manages status and args fd. // Args is always 3 and status if set is always 4. type Helper struct { - lock sync.RWMutex args io.WriterTo statP [2]*os.File @@ -32,6 +31,7 @@ type Helper struct { // standard error. If non-nil, entry i becomes file descriptor 5+i. ExtraFiles []*os.File + lock sync.RWMutex *exec.Cmd } @@ -177,7 +177,7 @@ func (h *Helper) Start() error { func New(wt io.WriterTo, name string, arg ...string) *Helper { if wt == nil { - panic("attempted to create helper with nil argument writer") + panic("attempted to create helper with invalid argument writer") } return &Helper{args: wt, Cmd: exec.Command(name, arg...)} -- cgit v1.3.1