aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hook.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/hook.go b/hook.go
index a5c84da..a9c0272 100644
--- a/hook.go
+++ b/hook.go
@@ -6,33 +6,19 @@ import (
"strings"
)
-type Hooker map[string]bool
+type Hooker map[string]struct{}
func execHook(s string) error {
cmd := strings.Fields(s)
return exec.Command(cmd[0], cmd[1:]...).Run()
}
-/*
-func NewHooker() chan string {
- h := make(chan string, 2)
- go func() {
- for hook := range h {
- if err := execHook(hook); err != nil {
- log.Println(hook, err)
- }
- }
- }()
- return h
-}
-*/
-
func NewHooker() Hooker {
return make(Hooker)
}
func (h Hooker) Notice(cmd string) {
- h[cmd] = true
+ h[cmd] = struct{}{}
}
func (h Hooker) Execute() {