podman

Форк
0
/
env_windows.go 
25 строк · 956.0 Байт
1
package env
2

3
// ParseSlice parses the specified slice and transforms it into an environment
4
// map.
5
func ParseSlice(s []string) (map[string]string, error) {
6
	env := make(map[string]string, len(s))
7
	for _, e := range s {
8
		if len(e) > 0 && e[0] == '=' {
9
			// The legacy Windows CMD command interpreter uses a hack, where to emulate
10
			// DOS semantics, it uses an illegal (by windows definition) env name for
11
			// state storage to avoid conflicting with user defined env names. This is
12
			// used to preserve drive letter paths. E.g., typing c: from another drive
13
			// will remember the last CWD because CMD stores it in an env named "=C:".
14
			// Since these are illegal, they are filtered from standard user access but
15
			// are still available in the underlying win32 API calls. Since they have
16
			// zero value to a container, we filter as well.
17
			continue
18
		}
19

20
		if err := parseEnv(env, e); err != nil {
21
			return nil, err
22
		}
23
	}
24
	return env, nil
25
}
26

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.