32 lines
502 B
Go
32 lines
502 B
Go
package buildx
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
|
|
"git.tek.govt.hu/dowerx/buildx-manager/config"
|
|
"github.com/sanity-io/litter"
|
|
)
|
|
|
|
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
|
|
|
|
fmt.Println("running command:")
|
|
litter.Dump(c)
|
|
|
|
if config.GetConfig().Verbose {
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
}
|
|
|
|
return cmd.Run()
|
|
}
|