From 849e0290b41bdd22396ee24ad0aa8c8ad9b7f60c Mon Sep 17 00:00:00 2001 From: xiantang Date: Mon, 24 Jun 2024 22:04:22 +0800 Subject: [PATCH] remove unused `WaitGroup` --- runner/engine.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runner/engine.go b/runner/engine.go index b95dfe39..0a69fa10 100644 --- a/runner/engine.go +++ b/runner/engine.go @@ -479,8 +479,7 @@ func (e *Engine) runPostCmd() error { } func (e *Engine) runBin() error { - killFunc := func(cmd *exec.Cmd, stdout io.ReadCloser, stderr io.ReadCloser, killCh chan struct{}, processExit chan struct{}, wg *sync.WaitGroup) { - defer wg.Done() + killFunc := func(cmd *exec.Cmd, stdout io.ReadCloser, stderr io.ReadCloser, killCh chan struct{}, processExit chan struct{}) { select { // listen to binStopCh // cleanup() will close binStopCh when engine stop @@ -519,13 +518,11 @@ func (e *Engine) runBin() error { e.runnerLog("running...") go func() { - wg := sync.WaitGroup{} defer func() { select { case <-e.exitCh: e.mainDebug("exit in runBin") - wg.Wait() default: } }() @@ -546,11 +543,10 @@ func (e *Engine) runBin() error { e.proxy.Reload() } - wg.Add(1) e.withLock(func() { close(e.binStopCh) e.binStopCh = make(chan bool) - go killFunc(cmd, stdout, stderr, killCh, processExit, &wg) + go killFunc(cmd, stdout, stderr, killCh, processExit) }) go func() {