Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# vim
*.swp
15 changes: 12 additions & 3 deletions webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"os"
"os/exec"
"strings"
"bytes"
"fmt"
)

// --------------------------------------------------------------------------------
Expand Down Expand Up @@ -49,12 +51,19 @@ var cfg Config

func runScript(item *WatchItem) (err error) {
script := "./" + item.Script
out, err := exec.Command("bash", "-c", script).Output()
cmd := exec.Command("bash", "-c", script)

var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &stderr
err = cmd.Run()

if err != nil {
log.Printf("Exec command failed: %s\n", err)
fmt.Println("Exec command failed, " + fmt.Sprint(err) + ": " + stderr.String())
}

log.Printf("Run %s output: %s\n", script, string(out))
log.Printf("Run %s output: %s\n", script, out.String())
return
}

Expand Down