diff --git a/proxy/debug.go b/proxy/debug.go index 9827d8c..3e7c29e 100644 --- a/proxy/debug.go +++ b/proxy/debug.go @@ -2,7 +2,6 @@ package proxy import ( "fmt" - "log" "strings" "github.com/Baipyrus/ProxySwitcher/util" @@ -21,13 +20,7 @@ func mapCmdsToStr(commands []*util.Command) string { } func Debug() { - proxy, err := ReadSystemProxy() - - if err != nil { - log.Fatal(err) - } - - // Debug system proxy configuration + proxy, _ := ReadSystemProxy() fmt.Println("\nSystem Proxy:") fmt.Printf("Enabled: %t\n", proxy.Enabled) fmt.Printf("Server: %s\n\n", proxy.Server) diff --git a/proxy/set.go b/proxy/set.go index 6892490..00c0b7f 100644 --- a/proxy/set.go +++ b/proxy/set.go @@ -1,19 +1,16 @@ package proxy import ( - "log" - "github.com/Baipyrus/ProxySwitcher/util" ) func Set() { stdin, closeFunc, _ := util.ReadyCmd() + proxy, _ := ReadSystemProxy() // Set system proxy, if not already - proxy, err := ReadSystemProxy() - - if err != nil { - log.Fatal(err) + if !proxy.Enabled { + SetSystemProxy(true) } configs, _ := util.ReadConfigs() diff --git a/proxy/unset.go b/proxy/unset.go index b9964d4..f4eade3 100644 --- a/proxy/unset.go +++ b/proxy/unset.go @@ -1,8 +1,6 @@ package proxy import ( - "log" - "github.com/Baipyrus/ProxySwitcher/util" ) @@ -10,12 +8,7 @@ func Unset() { stdin, closeFunc, _ := util.ReadyCmd() // Unset system proxy, if not already - proxy, err := ReadSystemProxy() - - if err != nil { - log.Fatal(err) - } - + proxy, _ := ReadSystemProxy() if proxy.Enabled { SetSystemProxy(false) }