MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / SetEnv

Function SetEnv

pkg/util/envutil/envutil.go:49–63  ·  view source on GitHub ↗
(envStr string, key string, val string)

Source from the content-addressed store, hash-verified

47}
48
49func SetEnv(envStr string, key string, val string) (string, error) {
50 if strings.ContainsAny(key, "=\x00") {
51 return "", fmt.Errorf("key cannot contain '=' or '\\x00'")
52 }
53 if strings.Contains(val, "\x00") {
54 return "", fmt.Errorf("value cannot contain '\\x00'")
55 }
56 if len(key)+len(val)+2+len(envStr) > MaxEnvSize {
57 return "", fmt.Errorf("env string too large (max %d bytes)", MaxEnvSize)
58 }
59 envMap := EnvToMap(envStr)
60 envMap[key] = val
61 rtnStr := MapToEnv(envMap)
62 return rtnStr, nil
63}
64
65func RmEnv(envStr string, key string) string {
66 envMap := EnvToMap(envStr)

Callers

nothing calls this directly

Calls 2

EnvToMapFunction · 0.85
MapToEnvFunction · 0.85

Tested by

no test coverage detected