Add exec output plugin (#6267)

This commit is contained in:
Greg
2019-08-20 18:07:24 -06:00
committed by Daniel Nelson
parent 1ad10c8a52
commit 819bf8e99d
6 changed files with 291 additions and 5 deletions

View File

@@ -230,17 +230,17 @@ func WaitTimeout(c *exec.Cmd, timeout time.Duration) error {
timer := time.AfterFunc(timeout, func() {
err := c.Process.Kill()
if err != nil {
log.Printf("E! FATAL error killing process: %s", err)
log.Printf("E! [agent] Error killing process: %s", err)
return
}
})
err := c.Wait()
isTimeout := timer.Stop()
if err == nil {
return nil
}
if err != nil {
return err
} else if isTimeout == false {
if !timer.Stop() {
return TimeoutErr
}