fix blocker self termination
All checks were successful
Deploy on Master Change / deploy (push) Successful in 36s
All checks were successful
Deploy on Master Change / deploy (push) Successful in 36s
This commit is contained in:
@@ -3,6 +3,7 @@ package blocker
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -282,6 +283,11 @@ func (b *Blocker) checkAndKill() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentExec := ""
|
||||||
|
if execPath, err := os.Executable(); err == nil {
|
||||||
|
currentExec = strings.ToLower(filepath.Base(execPath))
|
||||||
|
}
|
||||||
|
|
||||||
windows, err := EnumerateGUIWindows()
|
windows, err := EnumerateGUIWindows()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -291,8 +297,8 @@ func (b *Blocker) checkAndKill() {
|
|||||||
pNameLower := strings.ToLower(w.ProcessName)
|
pNameLower := strings.ToLower(w.ProcessName)
|
||||||
wTitleLower := strings.ToLower(w.Title)
|
wTitleLower := strings.ToLower(w.Title)
|
||||||
|
|
||||||
// 1. Luôn cho phép hệ thống/app cốt lõi hoặc chính tiến trình này
|
// 1. Luôn cho phép hệ thống/app cốt lõi hoặc chính tiến trình này (bao gồm tiến trình đổi tên)
|
||||||
if w.PID == uint32(os.Getpid()) || systemAllowed[pNameLower] || strings.Contains(pNameLower, "antigravity") || strings.Contains(wTitleLower, "antigravity") {
|
if w.PID == uint32(os.Getpid()) || (currentExec != "" && pNameLower == currentExec) || systemAllowed[pNameLower] || strings.Contains(pNameLower, "antigravity") || strings.Contains(wTitleLower, "antigravity") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user