检测应用程序崩溃并重新启动它的最佳方式? [英] Best way to detect an application crash and restart it?

查看:934
本文介绍了检测应用程序崩溃并重新启动它的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在XP中检测应用程序崩溃的最佳方法是(每次都生成相同的错误窗口,每个窗口标题相同),然后重新启动它?

What's the best way to detect an application crash in XP (produces the same pair of 'error' windows each time - each with same window title) and then restart it?

我特别感兴趣的是听到使用最少系统资源的解决方案,因为有问题的系统已经很老了。

I'm especially interested to hear of solutions that use minimal system resources as the system in question is quite old.

我想过使用像AutoIt这样的脚本语言( http://www.autoitscript.com/autoit3/ ),或者每隔几分钟触发一个探测器脚本?

I had thought of using a scripting language like AutoIt (http://www.autoitscript.com/autoit3/), and perhaps triggering a 'detector' script every few minutes?

这在Python,Perl,PowerShell或其他完全可以做得更好吗?

Would this be better done in Python, Perl, PowerShell or something else entirely?

,或想法非常赞赏。

编辑:它实际上不会崩溃(即退出/终止 - 感谢@tialaramex)。它显示一个等待用户输入的对话框,然后是另一个对话框等待进一步的用户输入,然后它实际退出。

It doesn't actually crash (i.e. exit/terminate - thanks @tialaramex). It displays a dialog waiting for user input, followed by another dialog waiting for further user input, then it actually exits. It's these dialogs that I'd like to detect and deal with.

推荐答案

如何创建一个包装应用程序来启动错误的应用程序作为一个孩子,等待它?如果子进程的退出代码指示错误,则重新启动它,否则退出。

How about creating a wrapper application that launches the faulty app as a child and waits for it? If the exit code of the child indicates an error, then restart it, else exit.

这篇关于检测应用程序崩溃并重新启动它的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆