NSNotification 检测其他程序崩溃
我计划编写一个小守护程序来检测另一个应用程序是否崩溃,一直认为系统会发送 NSWorkspaceDidTerminateApplicationNotification,但事实并非如此。
假设我不想创建 launchd 进程来简单地重新启动崩溃的应用程序,我可以通过其他方式检测崩溃吗?
也许我可以监控系统日志?这似乎过于沉重。
I was planning on writing a small daemon that detected whether another app crashed, thinking all the while that the system would send an NSWorkspaceDidTerminateApplicationNotification, but this is not the case.
Assuming that I do not want to create a launchd process to simply re-launch the crashed application, can I detect the crash any other way?
Perhaps I could monitor the system log? That seems unduly burdensome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
监视
/usr/sbin/spindump
进程是否/何时启动怎么样?How about watching for if/when the
/usr/sbin/spindump
process starts up?事实证明,最有效的崩溃监视器是读取 FSEventStream 中的崩溃日志。
Turns out what worked best as a crash monitor was reading the FSEventStream for Crash Logs.