add sources option
This commit is contained in:
parent
0c1ffa1cd9
commit
76f276f69e
2 changed files with 7 additions and 2 deletions
|
@ -10,7 +10,7 @@ type LinuxCommand struct {
|
||||||
|
|
||||||
type CommandOptions struct {
|
type CommandOptions struct {
|
||||||
Env map[string]string
|
Env map[string]string
|
||||||
Sources map[string]string
|
Sources []string
|
||||||
Command string
|
Command string
|
||||||
Args []string
|
Args []string
|
||||||
Cwd string
|
Cwd string
|
||||||
|
|
|
@ -29,7 +29,12 @@ func NewCommand(options CommandOptions) (*LinuxCommand, error) {
|
||||||
|
|
||||||
func (cmd *LinuxCommand) Run() error {
|
func (cmd *LinuxCommand) Run() error {
|
||||||
|
|
||||||
command := exec.Command(cmd.Options.Shell, "--rcfile", "testrc", "-c", cmd.Options.Command)
|
var sourceCommand string
|
||||||
|
for _, value := range cmd.Options.Sources {
|
||||||
|
sourceCommand += fmt.Sprintf("source %s && ", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
command := exec.Command(cmd.Options.Shell, "-c", sourceCommand+cmd.Options.Command)
|
||||||
command.Dir = cmd.Options.Cwd
|
command.Dir = cmd.Options.Cwd
|
||||||
command.Args = append(command.Args, cmd.Options.Args...)
|
command.Args = append(command.Args, cmd.Options.Args...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue