1

I am running a Python script that launches a number of apps. I need a way to detect if the app that's launched has crashed. Some apps have internal crash handling

The app has crashed and has a dialog box saying app has crashed

How can I detect the crash?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Rakshith Nt
  • 129
  • 7
  • what is your target platform? – Mark Nov 17 '17 at 04:36
  • Perhaps you could check if your processes are running and react accordingly? [See this question](https://stackoverflow.com/questions/3429250/determining-running-programs-in-python). – import random Nov 17 '17 at 04:43
  • Yes the processes are running because the exception is internally handled by the app and its displaying a dialogbox – Rakshith Nt Nov 17 '17 at 04:50

2 Answers2

2

If they have internal crash handling, it's not possible to detect. The application will handle the error and exit normally. You can't even detect this if you would attach yourself as a debugger.

The reason is exception dispatching (MSDN):

  1. the debugger gets informed about an exception. This is called the first chance exception. However, this might be "normal", e.g. FileNotFound, which is expected by the application.
  2. Windows is looking for someone who wants to handle the exception. This can be the except block of a Python application, a catch block in C# or C++ or even a general "unhandled exception handler".
  3. If nobody wanted to handle the application, the debugger gets informed again. This time, the exception is marked as a second chance exception. This means that the application will crash next.

You're looking to become informed as part of step 3, however, the application has already stopped the process in step 2.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
-1

if the subprocess crashes you should be able to see the dialogue box crash and prompted to take actions either "Debug" or "Close Program".

usman1947
  • 9
  • 5