mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Use the last NVIDIA_VISIBLE_DEVICES value from spec.
As described in #9401, we should use the last value of NVIDIA_VISIBLE_DEVICES from the container spec to emulate nvidia-container-runtime-hook correctly. Fixes #9401 PiperOrigin-RevId: 567480580
This commit is contained in:
@@ -657,9 +657,15 @@ func GetOOMScoreAdj(pid int) (int, error) {
|
||||
return strconv.Atoi(strings.TrimSpace(string(data)))
|
||||
}
|
||||
|
||||
// EnvVar looks for a varible value in the env slice assuming the following
|
||||
// format: "NAME=VALUE".
|
||||
// EnvVar looks for a variable value in the env slice assuming the following
|
||||
// format: "NAME=VALUE". If a variable is defined multiple times, the last
|
||||
// value is used.
|
||||
func EnvVar(env []string, name string) (string, bool) {
|
||||
var err error
|
||||
env, err = ResolveEnvs(env)
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
prefix := name + "="
|
||||
for _, e := range env {
|
||||
if strings.HasPrefix(e, prefix) {
|
||||
|
||||
Reference in New Issue
Block a user