mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Ensure DefaultEnvVariables is used in Specgen
When we rewrote Podman's pkg/spec, one of the things that was lost was our use of a set of default environment variables, that ensure all containers have at least $PATH and $TERM set. While we're in the process of re-adding it, change it from a variable to a function, so we can ensure the Join function does not overwrite it and corrupt the defaults. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
14
pkg/env/env.go
vendored
14
pkg/env/env.go
vendored
@ -12,14 +12,16 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DefaultEnvVariables sets $PATH and $TERM.
|
||||
var DefaultEnvVariables = map[string]string{
|
||||
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"TERM": "xterm",
|
||||
}
|
||||
|
||||
const whiteSpaces = " \t"
|
||||
|
||||
// DefaultEnvVariables returns a default environment, with $PATH and $TERM set.
|
||||
func DefaultEnvVariables() map[string]string {
|
||||
return map[string]string{
|
||||
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"TERM": "xterm",
|
||||
}
|
||||
}
|
||||
|
||||
// Slice transforms the specified map of environment variables into a
|
||||
// slice. If a value is non-empty, the key and value are joined with '='.
|
||||
func Slice(m map[string]string) []string {
|
||||
|
Reference in New Issue
Block a user