fix: change args by slice

This commit is contained in:
Urko. 2024-05-25 06:31:37 +02:00
parent 9c735ccf64
commit eaf0b1ff69
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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