buildx-manager/buildx/command.go

32 lines
504 B
Go
Raw Normal View History

2024-10-04 23:43:59 +00:00
package buildx
import (
2024-10-05 09:39:40 +00:00
"fmt"
2024-10-04 23:43:59 +00:00
"os"
"os/exec"
"git.tek.govt.hu/dowerx/buildx-manager/config"
2024-10-05 09:39:40 +00:00
"github.com/sanity-io/litter"
2024-10-04 23:43:59 +00:00
)
type Command struct {
Program string
Arguments []string
WorkingDirectory string
}
func (c *Command) Run() error {
cmd := exec.Command(c.Program, c.Arguments...)
cmd.Dir = c.WorkingDirectory
if config.GetConfig().Verbose {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
2024-10-05 09:39:40 +00:00
fmt.Println("running command:")
litter.Dump(c)
2024-10-04 23:43:59 +00:00
}
return cmd.Run()
}