diff --git a/command/agent/check.go b/command/agent/check.go index 6564a39fd..5573d4008 100644 --- a/command/agent/check.go +++ b/command/agent/check.go @@ -110,7 +110,6 @@ type CheckMonitor struct { Interval time.Duration Timeout time.Duration Logger *log.Logger - ReapLock *sync.RWMutex stop bool stopCh chan struct{} @@ -156,12 +155,6 @@ func (c *CheckMonitor) run() { // check is invoked periodically to perform the script check func (c *CheckMonitor) check() { - // Disable child process reaping so that we can get this command's - // return value. Note that we take the read lock here since we are - // waiting on a specific PID and don't need to serialize all waits. - c.ReapLock.RLock() - defer c.ReapLock.RUnlock() - // Create the command cmd, err := ExecScript(c.Script) if err != nil { diff --git a/command/agent/check_test.go b/command/agent/check_test.go index 72ecfac28..749a8351d 100644 --- a/command/agent/check_test.go +++ b/command/agent/check_test.go @@ -11,7 +11,6 @@ import ( "os" "os/exec" "strings" - "sync" "testing" "time" @@ -46,7 +45,6 @@ func expectStatus(t *testing.T, script, status string) { Script: script, Interval: 10 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -96,7 +94,6 @@ func TestCheckMonitor_Timeout(t *testing.T) { Interval: 10 * time.Millisecond, Timeout: 5 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -125,7 +122,6 @@ func TestCheckMonitor_RandomStagger(t *testing.T) { Script: "exit 0", Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -154,7 +150,6 @@ func TestCheckMonitor_LimitOutput(t *testing.T) { Script: "od -N 81920 /dev/urandom", Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop()