Question

I am looking for a means to kill a Windows exe program that, when being tested from a python script, crashes and presents a dialog to the user; as this program is invoked many times, and may crash repeatedly, this is not suitable.

The problem dialog is the standard reporting of a Windows error:

"Foo.exe has encountered a problem and needs to close. We are sorry for the inconvenience"

and offers a Debug, Send Error Report, and Don't Send buttons.

I am able to kill other forms of dialog resulting from crashes (e.g. a Debug build's assert failure dialog is OK.)

I have tried taskkill.exe, pskill, and the terminate() function on the Popen object from the subprocess module that was used to invoke the .exe

Has anyone encountered this specific issue, and found a resolution?

I expect automating user input to select the window, and press the "Don't Send" button is one possible solution, but I would like something far simpler if possible

Was it helpful?

Solution

Wouldn't it be easier to disable the error reporting feature?

OTHER TIPS

If you were to use CreateProcessEx or a WinAPI specific function, you might be able to call TerminateProcess or TerminateThread to forcibly end the process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top