From 8d47b6c66fcc07c3f51f9316cb7a9921db356418 Mon Sep 17 00:00:00 2001 From: PhuocNTB Date: Wed, 1 Jul 2026 08:38:18 +0700 Subject: [PATCH] fix blocker self termination --- client/internal/blocker/blocker.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/internal/blocker/blocker.go b/client/internal/blocker/blocker.go index 6089bf7..3502bd8 100644 --- a/client/internal/blocker/blocker.go +++ b/client/internal/blocker/blocker.go @@ -3,6 +3,7 @@ package blocker import ( "log" "os" + "path/filepath" "strings" "sync" "syscall" @@ -282,6 +283,11 @@ func (b *Blocker) checkAndKill() { return } + currentExec := "" + if execPath, err := os.Executable(); err == nil { + currentExec = strings.ToLower(filepath.Base(execPath)) + } + windows, err := EnumerateGUIWindows() if err != nil { return @@ -291,8 +297,8 @@ func (b *Blocker) checkAndKill() { pNameLower := strings.ToLower(w.ProcessName) 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 - if w.PID == uint32(os.Getpid()) || systemAllowed[pNameLower] || strings.Contains(pNameLower, "antigravity") || strings.Contains(wTitleLower, "antigravity") { + // 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()) || (currentExec != "" && pNameLower == currentExec) || systemAllowed[pNameLower] || strings.Contains(pNameLower, "antigravity") || strings.Contains(wTitleLower, "antigravity") { continue }