blob: ecc33b286392a7bed8e72dbb0a796a3d32ee3de5 (
plain) (
tree)
|
|
package hooks
import (
"os"
"os/exec"
"git.sr.ht/~rjarry/aerc/lib/log"
)
func RunHook(h HookType) error {
cmd := h.Cmd()
if cmd == "" {
return nil
}
env := h.Env()
log.Debugf("hooks: running command %q (env %v)", cmd, env)
proc := exec.Command("sh", "-c", cmd)
proc.Env = os.Environ()
proc.Env = append(proc.Env, env...)
return proc.Run()
}
|