gateway_windows -> chcp 437
This commit is contained in:
		
							parent
							
								
									dd4f956c58
								
							
						
					
					
						commit
						bf5ffd1c38
					
				@ -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"]
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user