Skip to content

Commit a9bb8ab

Browse files
authored
Merge pull request #286 from Tinyu-Zhao/master
修复在macOS下会将系统进程CursorUIViewService识别成Cursor进程的错误
2 parents 419dadf + 8bde884 commit a9bb8ab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/run/cursor_mac_id_modifier.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ check_and_kill_cursor() {
6969
get_process_details() {
7070
local process_name="$1"
7171
log_debug "正在获取 $process_name 进程详细信息:"
72-
ps aux | grep -i "$process_name" | grep -v grep
72+
ps aux | grep -i "/Applications/Cursor.app" | grep -v grep
7373
}
7474

7575
while [ $attempt -le $max_attempts ]; do
76-
CURSOR_PIDS=$(pgrep -i "cursor" || true)
76+
# 使用更精确的匹配来获取 Cursor 进程
77+
CURSOR_PIDS=$(ps aux | grep -i "/Applications/Cursor.app" | grep -v grep | awk '{print $2}')
7778

7879
if [ -z "$CURSOR_PIDS" ]; then
7980
log_info "未发现运行中的 Cursor 进程"
@@ -94,7 +95,8 @@ check_and_kill_cursor() {
9495

9596
sleep 1
9697

97-
if ! pgrep -i "cursor" > /dev/null; then
98+
# 同样使用更精确的匹配来检查进程是否还在运行
99+
if ! ps aux | grep -i "/Applications/Cursor.app" | grep -v grep > /dev/null; then
98100
log_info "Cursor 进程已成功关闭"
99101
return 0
100102
fi

0 commit comments

Comments
 (0)