문제

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

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top