Skip to content

Commit bb3c945

Browse files
committed
test: exit properly with swift_build_sdk_interface
`sys.exit` takes an integral value in the range of `0-127`. Python 3 is much more stringent about this and will convert the value if it is out of the range to 1. On Windows, explicitly use `ExitProcess` to ensure that we get the correct value on the exit code which matters to `not`.
1 parent 4f27eee commit bb3c945

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

utils/swift_build_sdk_interfaces.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ def main():
416416
non_stdlib_module_files = (
417417
x for x in module_files if x.name != STDLIB_NAME)
418418
status = process_module_files(pool, non_stdlib_module_files)
419+
if os.name == 'nt':
420+
import ctypes
421+
Kernel32 = ctypes.cdll.LoadLibrary("Kernel32.dll")
422+
Kernel32.ExitProcess(ctypes.c_ulong(status))
419423
sys.exit(status)
420424

421425

0 commit comments

Comments
 (0)