From bf5ffd1c385db240795d0995ea9d35145d08e462 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 23 Aug 2018 16:32:40 +0900 Subject: [PATCH] gateway_windows -> chcp 437 --- Gopkg.toml | 2 +- net/gateway/gateway_windows.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index 24f0f17..d7072c2 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ # Gopkg.toml example # -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html # for detailed Gopkg.toml documentation. # # required = ["github.com/user/thing/cmd/thing"] diff --git a/net/gateway/gateway_windows.go b/net/gateway/gateway_windows.go index 685f2c2..d481c7c 100644 --- a/net/gateway/gateway_windows.go +++ b/net/gateway/gateway_windows.go @@ -1,13 +1,17 @@ package gateway import ( + "log" "net" "os/exec" ) func DiscoverGateway() (ip net.IP, iface string, err error) { - routeCmd := exec.Command("route", "print", "0.0.0.0") - output, err := routeCmd.CombinedOutput() + output, err := exec.Command("cmd.exe", "/C", "chcp 437 && route print 0.0.0.0").CombinedOutput() + if err != nil { + panic(err) + } + log.Println(string(output)) if err != nil { return nil, "", err }