Skip to content

Commit

Permalink
Reroute Execute fns to new ExecuteEnvWithIO
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmccluskey committed Sep 6, 2023
1 parent 31119da commit 8cd24ca
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions sdks/go/pkg/beam/util/execx/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,13 @@ import (
// Execute runs the program with the given arguments. It attaches stdio to the
// child process.
func Execute(prog string, args ...string) error {
return ExecuteEnv(nil, prog, args...)
return ExecuteEnvWithIO(nil, os.Stdin, os.Stdout, os.Stderr, prog, args...)
}

// ExecuteEnv runs the program with the given arguments with additional environment
// variables. It attaches stdio to the child process.
func ExecuteEnv(env map[string]string, prog string, args ...string) error {
cmd := exec.Command(prog, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if env != nil {
cmd.Env = os.Environ()
for k, v := range env {
cmd.Env = append(cmd.Env, k+"="+v)
}
}

return cmd.Run()
return ExecuteEnvWithIO(env, os.Stdin, os.Stdout, os.Stderr, prog, args...)
}

// ExecuteEnvWithIO runs the program with the given arguments with additional environment
Expand Down

0 comments on commit 8cd24ca

Please sign in to comment.