diff --git a/.gitignore b/.gitignore index ee20f29..ad87e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .cover coverage webhook +/test/hookecho diff --git a/test/hookecho.go b/test/hookecho.go index 4ac4b4d..8e308ff 100644 --- a/test/hookecho.go +++ b/test/hookecho.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "strings" + "strconv" ) func main() { @@ -23,4 +24,14 @@ func main() { if len(env) > 0 { fmt.Printf("env: %s\n", strings.Join(env, " ")) } + + if (len(os.Args) > 1) && (strings.HasPrefix(os.Args[1], "exit=")) { + exit_code_str := os.Args[1][5:] + exit_code, err := strconv.Atoi(exit_code_str) + if err != nil { + fmt.Printf("Exit code %s not an int!", exit_code_str) + os.Exit(-1) + } + os.Exit(exit_code) + } }