mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-06 08:33:09 +00:00
feat(): expose hook ID to script environment
This commit is contained in:
parent
f29a1748ef
commit
d3777a7fcd
|
@ -2,6 +2,7 @@ package worker
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -38,7 +39,8 @@ func Run(work *model.WorkRequest) error {
|
|||
// Exec script with args...
|
||||
cmd := exec.Command(binary, work.Payload)
|
||||
// with env variables...
|
||||
cmd.Env = append(os.Environ(), work.Args...)
|
||||
workEnv := append(os.Environ(), fmt.Sprintf("hook_id=%d", work.ID))
|
||||
cmd.Env = append(workEnv, work.Args...)
|
||||
// using a process group...
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user