Message405166
> What is the most trivial way to test it's behaviour?
With CREATE_NO_WINDOW, the child process is attached to a console that has no window. Thus calling GetConsoleWindow() in the child returns NULL without an error. OTOH, if the child has no console (e.g. DETACHED_PROCESS or executing "pythonw.exe"), then GetConsoleWindow() returns NULL with the last error set to ERROR_INVALID_HANDLE (6). For example:
script = r'''
import sys
import ctypes
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
kernel32.GetConsoleWindow.restype = ctypes.c_void_p
ctypes.set_last_error(0)
result = kernel32.GetConsoleWindow()
status = bool(result or ctypes.get_last_error())
sys.exit(status)
'''
args = [sys.executable, '-c', script]
The child's exit status will be 0 if CREATE_NO_WINDOW works as expected. Otherwise the exit status will be 1. |
|
Date |
User |
Action |
Args |
2021-10-28 09:07:30 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, iMath, ohno, mmaswg |
2021-10-28 09:07:30 | eryksun | set | messageid: <1635412050.34.0.627790712488.issue30082@roundup.psfhosted.org> |
2021-10-28 09:07:30 | eryksun | link | issue30082 messages |
2021-10-28 09:07:30 | eryksun | create | |
|