Skip to content

Commit

Permalink
feat(golang-rewrite): correct execenv.Generate code
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratus3D committed Nov 27, 2024
1 parent 1210795 commit afd920e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/execenv/execenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const execEnvCallbackName = "exec-env"
func Generate(plugin plugins.Plugin, callbackEnv map[string]string) (env map[string]string, err error) {
execEnvPath, err := plugin.CallbackPath(execEnvCallbackName)
if err != nil {
return env, err
return callbackEnv, err
}

var stdout strings.Builder
Expand All @@ -27,7 +27,7 @@ func Generate(plugin plugins.Plugin, callbackEnv map[string]string) (env map[str
// executing the callback isn't enough. We actually need to source it (.) so
// the environment variables get set, and then run `env` so they get printed
// to STDOUT.
expression := execute.NewExpression(fmt.Sprintf(". %s; env", execEnvPath), []string{})
expression := execute.NewExpression(fmt.Sprintf(". \"%s\"; env", execEnvPath), []string{})
expression.Env = callbackEnv
expression.Stdout = &stdout
err = expression.Run()
Expand Down

0 comments on commit afd920e

Please sign in to comment.