detach.py
def _close_fd(self, fd):
        """Close a file descriptor if it is open."""
        try:
            os.close(fd)
        except OSError, exc:
            if exc.errno != errno.EBADF:
                msg = "Failed to close file descriptor {}: {}".format(fd, exc)
                raise Error(msg)
def _close_fd(self, fd):
        """Close a file descriptor if it is open."""
        try:
            os.close(fd)
        except OSError, exc:
            if exc.errno != errno.EBADF:
                msg = "Failed to close file descriptor {}: {}".format(fd, exc)
                raise Error(msg)
Close a file descriptor if it is open.