From 3166d415382aa5bbd8bb151cc50a756730cd5ec4 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Wed, 17 Feb 2016 16:29:35 +0900 Subject: [PATCH] set LC_ALL to C in order to avoid number formatting problem. --- internal/common/common_darwin.go | 2 ++ internal/common/common_freebsd.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/internal/common/common_darwin.go b/internal/common/common_darwin.go index 7d6f3c6..ef88936 100644 --- a/internal/common/common_darwin.go +++ b/internal/common/common_darwin.go @@ -3,6 +3,7 @@ package common import ( + "os" "os/exec" "strings" "syscall" @@ -10,6 +11,7 @@ import ( ) func DoSysctrl(mib string) ([]string, error) { + os.Setenv("LC_ALL", "C") out, err := exec.Command("/usr/sbin/sysctl", "-n", mib).Output() if err != nil { return []string{}, err diff --git a/internal/common/common_freebsd.go b/internal/common/common_freebsd.go index 44f194b..ef7b914 100644 --- a/internal/common/common_freebsd.go +++ b/internal/common/common_freebsd.go @@ -3,6 +3,7 @@ package common import ( + "os" "os/exec" "strings" "syscall" @@ -10,6 +11,7 @@ import ( ) func DoSysctrl(mib string) ([]string, error) { + os.Setenv("LC_ALL", "C") out, err := exec.Command("/sbin/sysctl", "-n", mib).Output() if err != nil { return []string{}, err