mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 12:32:06 +08:00
修复在macOS下会将系统进程CursorUIViewService识别成Cursor进程的错误
This commit is contained in:
parent
419dadf308
commit
8bde88472f
@ -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…
x
Reference in New Issue
Block a user