Skip to content


This module bundles platform specific flags and implementations.

CLOSE_FDS = True module-attribute #

Default setting for close_fds parameter to Popen/

Set close_fds on every sub process to this to ensure file handlers will be closed on child processes on platforms.

get_os() #

Returns a canonical OS identifier.

Currently the following OS are recognized: win32, linux (sys.platform = linux*), macos (sys.platform = darwin) and freebsd (sys.platform = freebsd*).


  • (str) mapped OS identifier

is_os_compatible(compatibility_entries, current_os = None) #

Tests if the current_os or sys.platform are blacklisted or whitelisted in compatibility_entries


  • (bool) True if the os is compatible, False otherwise

set_close_exec(handle) #

Set close_exec flag on handle, if supported by the OS.