fix: handle nil map issue
This commit is contained in:
1 parent
91975c5bfe
commit
1a498b0b76
1 file changed
+1
-1
@@ -76,7 +76,7 @@ func CommandUsage(helpHeader string, helpContent string) {
|
|||||||
|
|
||||||
// EnvWrap wraps a func with a setenv call and resets the value at the end
|
// EnvWrap wraps a func with a setenv call and resets the value at the end
|
||||||
func EnvWrap(fn func() error, environ map[string]string) error {
|
func EnvWrap(fn func() error, environ map[string]string) error {
|
||||||
var oldEnviron map[string]string
|
oldEnviron := map[string]string{}
|
||||||
for key, value := range environ {
|
for key, value := range environ {
|
||||||
oldEnviron[key] = os.Getenv(key)
|
oldEnviron[key] = os.Getenv(key)
|
||||||
if err := os.Setenv(key, value); err != nil {
|
if err := os.Setenv(key, value); err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user