fix: change args by slice
This commit is contained in:
parent
9c735ccf64
commit
eaf0b1ff69
|
@ -12,9 +12,9 @@ type Config struct {
|
|||
Projects map[string][]ConfigScript `yaml:"projects"`
|
||||
}
|
||||
type ConfigScript struct {
|
||||
Environment string `yaml:"environment"`
|
||||
Command string `yaml:"command"`
|
||||
Arguments string `yaml:"args"`
|
||||
Environment string `yaml:"environment"`
|
||||
Command string `yaml:"command"`
|
||||
Arguments []string `yaml:"args"`
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
|
|
6
main.go
6
main.go
|
@ -81,15 +81,15 @@ func handlePayload(secret string, projects map[string][]config.ConfigScript) fun
|
|||
}
|
||||
|
||||
go func() {
|
||||
if err := execute(scr.Command, scr.Arguments); err != nil {
|
||||
if err := execute(scr.Command, scr.Arguments...); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
func execute(command, args string) error {
|
||||
cmd := exec.Command(command, args)
|
||||
func execute(command string, args ...string) error {
|
||||
cmd := exec.Command(command, args...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
|
|
Loading…
Reference in New Issue