feat: 重构守护入口逻辑
This commit is contained in:
@@ -21,7 +21,6 @@ func Guardian(output bool) {
|
||||
os.Exit(1)
|
||||
}
|
||||
global.Status.Output = output
|
||||
time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second)
|
||||
go func() {
|
||||
defer func() {
|
||||
_ = recover()
|
||||
@@ -37,6 +36,7 @@ func Guardian(output bool) {
|
||||
c <- false
|
||||
}()
|
||||
<-c
|
||||
time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ func Login(output bool) error {
|
||||
util.Log.Println("Step0: 检查状态…")
|
||||
G := global.Config.Generate()
|
||||
|
||||
if !global.Status.Guardian && global.Config.Settings.QuitIfNetOk && util.Checker.NetOk() {
|
||||
util.Log.Println("网络正常,程序退出")
|
||||
if util.Checker.NetOk() {
|
||||
util.Log.Println("网络 ok")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user