mirror of
https://github.com/tw93/Mole.git
synced 2026-02-06 20:05:37 +00:00
fix: prevent Microsoft Teams from being misdetected as Edge
Fixes #313 Change browser process detection from pgrep -f (full command line match) to pgrep -x (exact process name match) to prevent false positives. Microsoft Teams processes contain 'Microsoft' in their paths and may have Chromium-based components, which was causing them to be incorrectly identified as Microsoft Edge during clean operations. Changes: - Chrome detection: pgrep -f → pgrep -x - Edge detection: pgrep -f → pgrep -x - Edge updater detection: pgrep -f → pgrep -x This approach is consistent with Firefox detection and prevents Apps like Microsoft Teams, Microsoft Office, or other Microsoft products from triggering false Edge detection. All existing tests pass (9/9 in clean_browser_versions.bats).
This commit is contained in:
@@ -84,8 +84,8 @@ clean_chrome_old_versions() {
|
||||
"$HOME/Applications/Google Chrome.app"
|
||||
)
|
||||
|
||||
# Use -f to match Chrome Helper processes as well
|
||||
if pgrep -f "Google Chrome" > /dev/null 2>&1; then
|
||||
# Match the exact Chrome process name to avoid false positives
|
||||
if pgrep -x "Google Chrome" > /dev/null 2>&1; then
|
||||
echo -e " ${YELLOW}${ICON_WARNING}${NC} Google Chrome running · old versions cleanup skipped"
|
||||
return 0
|
||||
fi
|
||||
@@ -164,8 +164,8 @@ clean_edge_old_versions() {
|
||||
"$HOME/Applications/Microsoft Edge.app"
|
||||
)
|
||||
|
||||
# Use -f to match Edge Helper processes as well
|
||||
if pgrep -f "Microsoft Edge" > /dev/null 2>&1; then
|
||||
# Match the exact Edge process name to avoid false positives (e.g., Microsoft Teams)
|
||||
if pgrep -x "Microsoft Edge" > /dev/null 2>&1; then
|
||||
echo -e " ${YELLOW}${ICON_WARNING}${NC} Microsoft Edge running · old versions cleanup skipped"
|
||||
return 0
|
||||
fi
|
||||
@@ -242,7 +242,7 @@ clean_edge_updater_old_versions() {
|
||||
local updater_dir="$HOME/Library/Application Support/Microsoft/EdgeUpdater/apps/msedge-stable"
|
||||
[[ -d "$updater_dir" ]] || return 0
|
||||
|
||||
if pgrep -f "Microsoft Edge" > /dev/null 2>&1; then
|
||||
if pgrep -x "Microsoft Edge" > /dev/null 2>&1; then
|
||||
echo -e " ${YELLOW}${ICON_WARNING}${NC} Microsoft Edge running · updater cleanup skipped"
|
||||
return 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user