Add environment variable support to instance options and command building

This commit is contained in:
2025-09-28 13:31:41 +02:00
parent 50e1355205
commit c984d95723
2 changed files with 35 additions and 2 deletions

View File

@@ -372,13 +372,23 @@ func (i *Process) buildCommand() (*exec.Cmd, error) {
return nil, err
}
// Build the environment variables
env := i.options.BuildEnvironment(backendConfig)
// Get the command to execute
cmd := i.options.GetCommand(backendConfig)
command := i.options.GetCommand(backendConfig)
// Build command arguments
args := i.options.BuildCommandArgs(backendConfig)
return exec.Command(cmd, args...), nil
// Create the exec.Cmd
cmd := exec.CommandContext(i.ctx, command, args...)
cmd.Env = []string{}
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
}
return cmd, nil
}
// getBackendConfig resolves the backend configuration for the current instance