def child_close_fds():
 global child_fd_list
 import os
 while (len(child_fd_list) > 0):
  fd = child_fd_list.pop(0)
  try:
   os.close(fd)
  except Exception as msg:
   pass

def child_close_fds ( ) : global child_fd_list import os while ( len ( child_fd_list ) > 0 ) : fd = child_fd_list . pop ( 0 ) try : os . close ( fd ) except Exception as msg : pass
close file descriptors that a child process should not inherit .