Skip to content

Commit

Permalink
fix(cursor_pro_keep_alive): 优化 Cursor 重启逻辑
Browse files Browse the repository at this point in the history
- 在重启 Cursor 后添加 os._exit(0) 以确保进程正确退出
- 在重启失败时添加 os._exit(1) 返回非零错误码
- 移除不必要的 sys.exit() 替代 os._exit() 的注释
  • Loading branch information
wqjuser committed Feb 5, 2025
1 parent 6787a8e commit f34dc9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cursor_pro_keep_alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,10 @@ def inner_restart_cursor():
else:
subprocess.Popen(['open', cursor_path])
logging.info("Cursor 已重新启动")
os._exit(0)
except Exception as exception:
logging.error(f"重启 Cursor 失败: {str(exception)}")
os._exit(1)


if __name__ == "__main__":
Expand Down Expand Up @@ -549,8 +551,6 @@ def inner_restart_cursor():
if is_success:
# 重启Cursor并退出
restart_cursor()
# 使用 sys.exit() 替代 os._exit()
sys.exit(0)
else:
print("\n程序执行失败,按回车键退出...", end='', flush=True)
input()
Expand Down

0 comments on commit f34dc9f

Please sign in to comment.