Robustly killing Windows programs stuck reporting 'problems'

Posted by grrussel on Stack Overflow See other posts from Stack Overflow or by grrussel
Published on 2010-06-01T18:56:19Z Indexed on 2010/06/01 20:13 UTC
Read the original article Hit count: 366

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

© Stack Overflow or respective owner

Related posts about python

Related posts about Windows