Files
digital-psychology/tools/cece_launch_deep.py
T
jackyu66gitandCursor 53eb4577b3 feat: 按测测功能重构 H5 首页与各子页,并修正顶栏「+」添加档案菜单
对齐测测交互:首页「+」支持邀请填档案/添加档案/邀请合盘;各 Tab 与工具页按同一视觉与功能标准落地;本地对照截图目录显式忽略。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 14:32:35 +08:00

54 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Stable launcher for cece_capture_deep — logs exit code, avoids silent death."""
from __future__ import annotations
import atexit
import faulthandler
import os
import runpy
import sys
import time
from pathlib import Path
LOG = Path("/tmp/cece-capture-deep-full.log")
FAULT = Path("/tmp/cece-fault.log")
ROOT = Path("/Users/jack/Project/digital-psychology")
def _log(msg: str) -> None:
line = f"[{time.strftime('%F %T')}] {msg}\n"
with LOG.open("a", encoding="utf-8") as f:
f.write(line)
sys.stdout.write(line)
sys.stdout.flush()
def main() -> int:
os.chdir(ROOT)
FAULT.parent.mkdir(parents=True, exist_ok=True)
ff = FAULT.open("a", encoding="utf-8")
faulthandler.enable(file=ff, all_threads=True)
_log(f"launcher start pid={os.getpid()} argv={sys.argv[1:]}")
def _atexit() -> None:
_log(f"atexit pid={os.getpid()}")
atexit.register(_atexit)
sys.argv = ["cece_capture_deep.py", *sys.argv[1:]]
try:
runpy.run_path(str(ROOT / "tools" / "cece_capture_deep.py"), run_name="__main__")
_log("launcher normal return")
return 0
except BaseException as ex:
_log(f"launcher exception: {type(ex).__name__}: {ex}")
import traceback
with LOG.open("a", encoding="utf-8") as f:
traceback.print_exc(file=f)
traceback.print_exc()
return 1
if __name__ == "__main__":
raise SystemExit(main())