Skip to content

Commit

Permalink
Consolidate identical newExecCmd() implementations
Browse files Browse the repository at this point in the history
These two implementations existed in the `unix` and `windows` variants
of `exec_cmd_runner`. Perhaps they differed in the past but at present
they are identical. This consolidates the two implementations into
`exec_cmd_runner.go` from the respective OS-specific files.
  • Loading branch information
aramprice committed Dec 13, 2024
1 parent 6f5bb2a commit d7fc3e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 4 additions & 0 deletions system/exec_cmd_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ func (r execCmdRunner) buildComplexCommand(cmd Command) *exec.Cmd {

return execCmd
}

func newExecCmd(name string, args ...string) *exec.Cmd {
return exec.Command(name, args...)
}
6 changes: 1 addition & 5 deletions system/exec_cmd_runner_unix.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
//go:build !windows
// +build !windows

package system

import (
"os/exec"
"strings"
)

func newExecCmd(name string, args ...string) *exec.Cmd {
return exec.Command(name, args...)
}

// mergeEnv merges system and command environments variables. Command variables
// override any system variable with the same key.
func mergeEnv(sysEnv []string, cmdEnv map[string]string) []string {
Expand Down
5 changes: 0 additions & 5 deletions system/exec_cmd_runner_windows.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package system

import (
"os/exec"
"sort"
"strings"
)

func newExecCmd(name string, args ...string) *exec.Cmd {
return exec.Command(name, args...)
}

// mergeEnv case-insensitive merge of system and command environments variables.
// Command variables override any system variable with the same key.
func mergeEnv(sysEnv []string, cmdEnv map[string]string) []string {
Expand Down

0 comments on commit d7fc3e1

Please sign in to comment.