Browse Source

修复在macOS下会将系统进程CursorUIViewService识别成Cursor进程的错误

pull/286/head
Tinyu-Zhao 3 months ago
parent
commit
8bde88472f
  1. 8
      scripts/run/cursor_mac_id_modifier.sh

8
scripts/run/cursor_mac_id_modifier.sh

@ -69,11 +69,12 @@ check_and_kill_cursor() {
get_process_details() { get_process_details() {
local process_name="$1" local process_name="$1"
log_debug "正在获取 $process_name 进程详细信息:" 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 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 if [ -z "$CURSOR_PIDS" ]; then
log_info "未发现运行中的 Cursor 进程" log_info "未发现运行中的 Cursor 进程"
@ -94,7 +95,8 @@ check_and_kill_cursor() {
sleep 1 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 进程已成功关闭" log_info "Cursor 进程已成功关闭"
return 0 return 0
fi fi

Loading…
Cancel
Save