Eryk Sun <eryk...@gmail.com> added the comment:

> On Windows, os.waitpid() status also requires an operation (shif 
> right by 8 bits) to get an exitcode from the waitpid status. 

FWIW, I wouldn't recommend relying on os.waitpid to get the correct process 
exit status in Windows. Status codes are 32 bits and generally all bits are 
required. os.waitpid left shifts the exit status by 8 bits in a dubious attempt 
to return a result that's "more like the POSIX waitpid". In particular, a 
program may exit abnormally with an NTSTATUS [1] or HRESULT [2] code such as 
STATUS_DLL_NOT_FOUND (0xC000_0135) or STATUS_CONTROL_C_EXIT (0xC000_013A).

[1]: 
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781
[2]: 
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40094>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to