Skip to content

Commit d9d89c0

Browse files
committed
Ensure commands are constructed properly, add debugging
1 parent c54e5e7 commit d9d89c0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

internal/osutils/exeutils_windows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"syscall"
99

1010
"github.com/thoas/go-funk"
11+
12+
"github.com/ActiveState/cli/internal/logging"
1113
)
1214

1315
const ExeExtension = ".exe"
@@ -28,6 +30,7 @@ func Command(name string, arg ...string) *exec.Cmd {
2830
// other characters that need escaping such as `<` and `>`.
2931
// This can be dropped once we update to a Go version that fixes this bug: https://github.com/golang/go/issues/68313
3032
cmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: makeCmdLine(cmd.Args)}
33+
logging.Debug("Forcing command line: %s", cmd.SysProcAttr.CmdLine)
3134
}
3235

3336
return cmd

internal/subshell/sscommon/sscommon.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func NewCommand(command string, args []string, env []string) *exec.Cmd {
18-
cmd := exec.Command(command, args...)
18+
cmd := osutils.Command(command, args...)
1919
if env != nil {
2020
cmd.Env = append(os.Environ(), env...)
2121
}
@@ -166,7 +166,7 @@ func binaryPathCmd(env []string, name string) (string, error) {
166166
func runDirect(env []string, name string, args ...string) (rerr error) {
167167
logging.Debug("Running command: %s %s", name, strings.Join(args, " "))
168168

169-
runCmd := exec.Command(name, args...)
169+
runCmd := osutils.Command(name, args...)
170170
runCmd.Stdin, runCmd.Stdout, runCmd.Stderr = os.Stdin, os.Stdout, os.Stderr
171171
runCmd.Env = env
172172

0 commit comments

Comments
 (0)