File: helpers_windows_test.go

package info (click to toggle)
golang-github-minio-cli 1.3.0+git20170313.0.8683fa7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 580 kB
  • ctags: 805
  • sloc: python: 241; sh: 10; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 377 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package cli

import (
	"os"
	"syscall"
)

// os.Clearenv() doesn't actually unset variables on Windows
// See: https://github.com/golang/go/issues/17902
func clearenv() {
	for _, s := range os.Environ() {
		for j := 1; j < len(s); j++ {
			if s[j] == '=' {
				keyp, _ := syscall.UTF16PtrFromString(s[0:j])
				syscall.SetEnvironmentVariable(keyp, nil)
				break
			}
		}
	}
}