diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-09-25 14:00:30 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-09-25 14:00:30 +0900 |
| commit | 8492239cba18c66c2b6dc76eaf3314f11b38b10b (patch) | |
| tree | 0e97dbe40e3d955c899acb7d7752e763910150eb /helper/helper.go | |
| parent | a8b4b3634b8bef6040601d970a7c178da72b114d (diff) | |
helper/args: simplify argument parsing and eliminate excess memory copies
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'helper/helper.go')
| -rw-r--r-- | helper/helper.go | 4 |
1 files changed, 2 insertions, 2 deletions
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...)} |
