mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 桌面端内核进程根据 Electron 主进程判断是否自动退出 Fix https://github.com/siyuan-note/siyuan/issues/7002
This commit is contained in:
parent
3c65021b83
commit
bdec1215a0
1 changed files with 7 additions and 10 deletions
|
|
@ -42,12 +42,7 @@ func HookDesktopUIProc() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uiProcName := "siyuan"
|
uiProcNames := []string{"siyuan", "electron"}
|
||||||
if "dev" == util.Mode {
|
|
||||||
uiProcName = "electron"
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(30 * time.Second)
|
|
||||||
existUIProc := false
|
existUIProc := false
|
||||||
for range time.Tick(7 * time.Second) {
|
for range time.Tick(7 * time.Second) {
|
||||||
util.UIProcessIDs.Range(func(uiProcIDArg, _ interface{}) bool {
|
util.UIProcessIDs.Range(func(uiProcIDArg, _ interface{}) bool {
|
||||||
|
|
@ -63,11 +58,13 @@ func HookDesktopUIProc() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(strings.ToLower(proc.Executable()), uiProcName) {
|
procName := strings.ToLower(proc.Executable())
|
||||||
existUIProc = true
|
for _, name := range uiProcNames {
|
||||||
return false
|
if strings.Contains(procName, name) {
|
||||||
|
existUIProc = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue