glasswall.config.creationflags

 1import ctypes
 2import os
 3
 4import glasswall
 5
 6# Don't display the Windows GPF dialog if the invoked program dies.
 7# https://stackoverflow.com/a/24131590
 8# Use by setting kwarg "creationflags" as int in subprocess.call(..., creationflags=int(os.environ["creationflags"])
 9if glasswall._OPERATING_SYSTEM == "Windows":
10    SEM_NOGPFAULTERRORBOX = 0x0002  # From MSDN
11    ctypes.windll.kernel32.SetErrorMode(SEM_NOGPFAULTERRORBOX)
12    CREATE_NO_WINDOW = 0x08000000  # From Windows API
13    os.environ["creationflags"] = str(CREATE_NO_WINDOW)
14else:
15    os.environ["creationflags"] = str(0)