You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
377 B

  1. package cli
  2. import (
  3. "os"
  4. "syscall"
  5. )
  6. // os.Clearenv() doesn't actually unset variables on Windows
  7. // See: https://github.com/golang/go/issues/17902
  8. func clearenv() {
  9. for _, s := range os.Environ() {
  10. for j := 1; j < len(s); j++ {
  11. if s[j] == '=' {
  12. keyp, _ := syscall.UTF16PtrFromString(s[0:j])
  13. syscall.SetEnvironmentVariable(keyp, nil)
  14. break
  15. }
  16. }
  17. }
  18. }