From 76f276f69e425c2cc9b3045f741b6a0c1e52264e Mon Sep 17 00:00:00 2001 From: Shane C Date: Thu, 4 Jul 2024 18:08:45 -0400 Subject: [PATCH] add sources option --- linux/interface.go | 2 +- linux/run.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/linux/interface.go b/linux/interface.go index 384ef94..ed25b04 100644 --- a/linux/interface.go +++ b/linux/interface.go @@ -10,7 +10,7 @@ type LinuxCommand struct { type CommandOptions struct { Env map[string]string - Sources map[string]string + Sources []string Command string Args []string Cwd string diff --git a/linux/run.go b/linux/run.go index e2bb35d..7c612d7 100644 --- a/linux/run.go +++ b/linux/run.go @@ -29,7 +29,12 @@ func NewCommand(options CommandOptions) (*LinuxCommand, 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.Args = append(command.Args, cmd.Options.Args...)