'Test for the fork() failure fd leak reported in issue16327.'

@unittest.skipUnless(os.path.isdir(('/proc/%d/fd' % os.getpid())), 'Linux    specific')
def test_failed_child_execute_fd_leak(self):

    fd_directory = ('/proc/%d/fd' % os.getpid())
    fds_before_popen = os.listdir(fd_directory)
    with self.assertRaises(PopenTestException):
        PopenExecuteChildRaises([sys.executable, '-c', 'pass'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    fds_after_exception = os.listdir(fd_directory)
    self.assertEqual(fds_before_popen, fds_after_exception)
