MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / prependPath

Function prependPath

cmd/pulumi.go:1229–1242  ·  view source on GitHub ↗

prependPath returns a copy of env with the given directory prepended to PATH.

(env []string, dir string)

Source from the content-addressed store, hash-verified

1227
1228// prependPath returns a copy of env with the given directory prepended to PATH.
1229func prependPath(env []string, dir string) []string {
1230 const prefix = "PATH="
1231 result := make([]string, len(env))
1232 copy(result, env)
1233 for i, e := range result {
1234 if strings.HasPrefix(e, prefix) {
1235 result[i] = prefix + dir + string(os.PathListSeparator) + e[len(prefix):]
1236 return result
1237 }
1238 }
1239 // PATH not found in env — add it
1240 result = append(result, prefix+dir)
1241 return result
1242}
1243
1244// prependPythonPath returns a copy of env with the given directory prepended to PYTHONPATH.
1245func prependPythonPath(env []string, dir string) []string {

Callers 1

runUserProgramToFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected