Files
iOSAI/tidevice_entry.py

16 lines
585 B
Python
Raw Normal View History

2025-09-17 22:59:15 +08:00
import sys, traceback, os
from tidevice.__main__ import main
2025-09-19 15:11:23 +08:00
if hasattr(sys, 'frozen') and sys.executable.endswith('.exe'):
# 打包后且无控制台时,把标准流扔掉
sys.stdout = sys.stderr = open(os.devnull, 'w', encoding='utf-8')
2025-09-17 22:59:15 +08:00
if __name__ == "__main__":
try:
main()
except Exception:
# 把 traceback 写到日志文件,但**不输出到控制台**
with open(os.path.expanduser("~/tidevice_crash.log"), "a", encoding="utf-8") as f:
traceback.print_exc(file=f)
2025-09-19 15:11:23 +08:00
# 静默退出,返回码 1
sys.exit(1)