[pypy-commit] pypy windows-no-err-dlg: prevent windows testrunner from opening system error dialog boxes

mattip noreply at buildbot.pypy.org
Tue Dec 20 21:01:18 CET 2011


Author: mattip
Branch: windows-no-err-dlg
Changeset: r50772:f01058ed1577
Date: 2011-12-20 21:59 +0200
http://bitbucket.org/pypy/pypy/changeset/f01058ed1577/

Log:	prevent windows testrunner from opening system error dialog boxes

diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -21,7 +21,17 @@
                 win32api.CloseHandle(proch)
             except pywintypes.error, e:
                 pass
-
+    #Try to avoid opeing a dialog box if one of the tests causes a system error
+    import ctypes
+    winapi = ctypes.windll.kernel32
+    SEM_FAILCRITICALERRORS = 1
+    SEM_NOGPFAULTERRORBOX  = 2
+    SEM_NOOPENFILEERRORBOX = 0x8000
+    flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX
+    #Since there is no GetErrorMode, do a double Set
+    old_mode = winapi.SetErrorMode(flags)
+    winapi.SetErrorMode(old_mode | flags)
+                                                   
     SIGKILL = SIGTERM = 0
     READ_MODE = 'rU'
     WRITE_MODE = 'wb'


More information about the pypy-commit mailing list