Skip to content

Commit

Permalink
only use shell when set, always pass environment
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Nov 3, 2014
1 parent dbc566f commit 8dbf34a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions dockerhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

var debug = flag.Bool("d", false, "debug mode displays handler output")
var env = flag.Bool("e", false, "pass environment to handler")
var shell = flag.Bool("s", false, "run handler via SHELL")

var skipInspect = map[string]bool {
Expand Down Expand Up @@ -80,14 +79,11 @@ func trigger(hook []string, event, id string, docker *dockerapi.Client) {
log.Println("info: trigger:", id[:12], event)
hook = append(hook, event, id)
var cmd *exec.Cmd
if *shell {
if *shell && os.Getenv("SHELL") != "" {
cmd = exec.Command(os.Getenv("SHELL"), "-c", strings.Join(hook, " "))
} else {
cmd = exec.Command(hook[0], hook[1:]...)
}
if !*env {
cmd.Env = []string{}
}
if !skipInspect[event] {
cmd.Stdin = inspect(docker, id)
}
Expand Down

0 comments on commit 8dbf34a

Please sign in to comment.