diff --git a/internal/runners/exec/exec.go b/internal/runners/exec/exec.go index 038d1354a9..112d39482e 100644 --- a/internal/runners/exec/exec.go +++ b/internal/runners/exec/exec.go @@ -24,7 +24,7 @@ import ( "github.com/ActiveState/cli/internal/output" "github.com/ActiveState/cli/internal/primer" "github.com/ActiveState/cli/internal/runbits/rationalize" - "github.com/ActiveState/cli/internal/runbits/runtime" + runtime_runbit "github.com/ActiveState/cli/internal/runbits/runtime" "github.com/ActiveState/cli/internal/runbits/runtime/trigger" "github.com/ActiveState/cli/internal/subshell" "github.com/ActiveState/cli/internal/virtualenvironment" diff --git a/pkg/runtime/internal/envdef/collection.go b/pkg/runtime/internal/envdef/collection.go index 3801ff4ba7..fbb2077b57 100644 --- a/pkg/runtime/internal/envdef/collection.go +++ b/pkg/runtime/internal/envdef/collection.go @@ -1,7 +1,9 @@ package envdef import ( + "os" "path/filepath" + "runtime" "sync" "github.com/ActiveState/cli/internal/errs" @@ -63,5 +65,29 @@ func (c *Collection) Environment(installPath string, inherit bool) (map[string]s } } constants := NewConstants(installPath) - return result.ExpandVariables(constants).GetEnv(inherit), nil + env := result.ExpandVariables(constants).GetEnv(inherit) + promotePath(env) + return env, nil +} + +// promotPath is a temporary fix to ensure that the PATH is interpreted correctly on Windows +// Should be properly addressed by https://activestatef.atlassian.net/browse/DX-3030 +func promotePath(env map[string]string) { + if runtime.GOOS != "windows" { + return + } + + PATH, exists := env["PATH"] + if !exists { + return + } + + // If Path exists, prepend PATH values to it + Path, pathExists := env["Path"] + if !pathExists { + return + } + + env["Path"] = PATH + string(os.PathListSeparator) + Path + delete(env, "PATH") } diff --git a/test/integration/exec_int_test.go b/test/integration/exec_int_test.go index f3cfff58d7..acd8cd8345 100644 --- a/test/integration/exec_int_test.go +++ b/test/integration/exec_int_test.go @@ -8,7 +8,6 @@ import ( "runtime" "strings" "testing" - "time" "github.com/ActiveState/cli/internal/constants" "github.com/ActiveState/cli/internal/environment" @@ -16,7 +15,6 @@ import ( "github.com/ActiveState/cli/internal/testhelpers/e2e" "github.com/ActiveState/cli/internal/testhelpers/suite" "github.com/ActiveState/cli/internal/testhelpers/tagsuite" - "github.com/ActiveState/termtest" ) type ExecIntegrationTestSuite struct { @@ -176,7 +174,7 @@ func (suite *ExecIntegrationTestSuite) TestExeBatArguments() { inputs := []string{"aa", "hello world", "&whoami", "imnot|apipe", "%NotAppData%", "^NotEscaped", "(NotAGroup)"} outputs := `"` + strings.Join(inputs, `" "`) + `"` cp = ts.SpawnWithOpts(e2e.OptArgs(append([]string{"exec", reportBat, "--"}, inputs...)...)) - cp.Expect(outputs, termtest.OptExpectTimeout(5*time.Second)) + cp.Expect(outputs, e2e.RuntimeBuildSourcingTimeoutOpt) cp.ExpectExitCode(0) } diff --git a/version.txt b/version.txt index 6f06a9f061..4c8c50fc8d 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.46.0-RC2 +0.46.0-RC3 \ No newline at end of file