Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Executors should not setup environment (again) in an activated state." #2712

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions cmd/state-exec/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (
"path/filepath"
"strings"

"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/hash"
"github.com/ActiveState/cli/internal/installation/storage"
"github.com/ActiveState/cli/pkg/platform/runtime/executors/execmeta"
)

Expand Down Expand Up @@ -37,24 +34,10 @@ func newExecutorMeta(execPath string) (*executorMeta, error) {
return nil, fmt.Errorf("cannot get matching bin by path: %w", err)
}

transformEnv := true
if projectDir := os.Getenv(constants.ActivatedStateEnvVarName); projectDir != "" {
// Note: cannot import runtime/target for ProjectDirToTargetDir() because that would bloat
// up the exe from <4MB to >15MB.
projectCacheDir := filepath.Join(storage.CachePath(), hash.ShortHash(projectDir))
if projectCacheDir == execDir {
transformEnv = false // runtime environment variables already set
}
}

env := os.Environ()
if transformEnv {
env = transformedEnv(env, meta.Env)
}
em := executorMeta{
ExecMeta: meta,
MatchingBin: matchingBin,
TransformedEnv: env,
TransformedEnv: transformedEnv(os.Environ(), meta.Env),
}

return &em, nil
Expand Down
Loading