Skip to content

Commit 8dbf34a

Browse files
committed
only use shell when set, always pass environment
1 parent dbc566f commit 8dbf34a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

dockerhook.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
)
1818

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

2322
var skipInspect = map[string]bool {
@@ -80,14 +79,11 @@ func trigger(hook []string, event, id string, docker *dockerapi.Client) {
8079
log.Println("info: trigger:", id[:12], event)
8180
hook = append(hook, event, id)
8281
var cmd *exec.Cmd
83-
if *shell {
82+
if *shell && os.Getenv("SHELL") != "" {
8483
cmd = exec.Command(os.Getenv("SHELL"), "-c", strings.Join(hook, " "))
8584
} else {
8685
cmd = exec.Command(hook[0], hook[1:]...)
8786
}
88-
if !*env {
89-
cmd.Env = []string{}
90-
}
9187
if !skipInspect[event] {
9288
cmd.Stdin = inspect(docker, id)
9389
}

0 commit comments

Comments
 (0)