1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

fix: don't override env (#1629)

This commit is contained in:
Jason Song 2023-02-16 23:16:46 +08:00 committed by GitHub
parent 41da84cbb5
commit 1b88ccb803

View file

@ -186,9 +186,11 @@ func (rc *RunContext) startHostEnvironment() common.Executor {
}
}
for _, env := range os.Environ() {
i := strings.Index(env, "=")
if i > 0 {
rc.Env[env[0:i]] = env[i+1:]
if k, v, ok := strings.Cut(env, "="); ok {
// don't override
if _, ok := rc.Env[k]; !ok {
rc.Env[k] = v
}
}
}