UPDATE: Enhance macOS support with new build steps, add admin relaunch functionality, and improve proxy management
Build and Release / release (push) Failing after 41s
Build and Release / release (push) Failing after 41s
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
zlog "github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func startProxyRefreshLoop(host string, port string) func() {
|
||||
done := make(chan struct{})
|
||||
stopped := make(chan struct{})
|
||||
var once sync.Once
|
||||
|
||||
go func() {
|
||||
defer close(stopped)
|
||||
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-done:
|
||||
return
|
||||
case <-ticker.C:
|
||||
if err := setProxy(true, host, port); err != nil {
|
||||
zlog.Error().Err(err).Msg("Failed to refresh macOS proxy services")
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return func() {
|
||||
once.Do(func() {
|
||||
close(done)
|
||||
<-stopped
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user