From 8bde88472f0f5af738b723c189ce6a979f38ff13 Mon Sep 17 00:00:00 2001 From: Tinyu-Zhao Date: Mon, 3 Mar 2025 09:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8macOS=E4=B8=8B?= =?UTF-8?q?=E4=BC=9A=E5=B0=86=E7=B3=BB=E7=BB=9F=E8=BF=9B=E7=A8=8BCursorUIV?= =?UTF-8?q?iewService=E8=AF=86=E5=88=AB=E6=88=90Cursor=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/run/cursor_mac_id_modifier.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/run/cursor_mac_id_modifier.sh b/scripts/run/cursor_mac_id_modifier.sh index ec40724..204db48 100644 --- a/scripts/run/cursor_mac_id_modifier.sh +++ b/scripts/run/cursor_mac_id_modifier.sh @@ -69,11 +69,12 @@ check_and_kill_cursor() { get_process_details() { local process_name="$1" log_debug "正在获取 $process_name 进程详细信息:" - ps aux | grep -i "$process_name" | grep -v grep + ps aux | grep -i "/Applications/Cursor.app" | grep -v grep } while [ $attempt -le $max_attempts ]; do - CURSOR_PIDS=$(pgrep -i "cursor" || true) + # 使用更精确的匹配来获取 Cursor 进程 + CURSOR_PIDS=$(ps aux | grep -i "/Applications/Cursor.app" | grep -v grep | awk '{print $2}') if [ -z "$CURSOR_PIDS" ]; then log_info "未发现运行中的 Cursor 进程" @@ -94,7 +95,8 @@ check_and_kill_cursor() { sleep 1 - if ! pgrep -i "cursor" > /dev/null; then + # 同样使用更精确的匹配来检查进程是否还在运行 + if ! ps aux | grep -i "/Applications/Cursor.app" | grep -v grep > /dev/null; then log_info "Cursor 进程已成功关闭" return 0 fi