Browse Source

fix: wait for async command exit (#1326)

This prevents the accumulation of zombie processes when using
async (&) event commands. Also log async command failures.
pull/1331/head
Jürgen Hötzel 1 year ago
committed by GitHub
parent
commit
6d5ceae8b4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      runner/runner.go

8
runner/runner.go

@ -102,6 +102,14 @@ func (r *Runner) exec(raw, evt, path, dst string, user *users.User) error {
if !blocking {
log.Printf("[INFO] Nonblocking Command: \"%s\"", strings.Join(command, " "))
defer func() {
go func() {
err := cmd.Wait()
if err != nil {
log.Printf("[INFO] Nonblocking Command \"%s\" failed: %s", strings.Join(command, " "), err)
}
}()
}()
return cmd.Start()
}

Loading…
Cancel
Save