Skip to content

Commit 13e6d18

Browse files
committed
fix: use global env variables when executing
1 parent 836f941 commit 13e6d18

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

exec.go

+1-19
Original file line numberDiff line numberDiff line change
@@ -434,26 +434,8 @@ func execHandle(bg bool) interp.ExecHandlerFunc {
434434
// sh/interp but with our job handling
435435

436436
env := hc.Env
437-
envList := make([]string, 0, 64)
437+
envList := os.Environ()
438438
env.Each(func(name string, vr expand.Variable) bool {
439-
if name == "PATH" {
440-
pathEnv := os.Getenv("PATH")
441-
envList = append(envList, "PATH="+pathEnv)
442-
return true
443-
}
444-
445-
if !vr.IsSet() {
446-
// If a variable is set globally but unset in the
447-
// runner, we need to ensure it's not part of the final
448-
// list. Seems like zeroing the element is enough.
449-
// This is a linear search, but this scenario should be
450-
// rare, and the number of variables shouldn't be large.
451-
for i, kv := range envList {
452-
if strings.HasPrefix(kv, name+"=") {
453-
envList[i] = ""
454-
}
455-
}
456-
}
457439
if vr.Exported && vr.Kind == expand.String {
458440
envList = append(envList, name+"="+vr.String())
459441
}

0 commit comments

Comments
 (0)