def log(self):
        if self.shouldControlTerminal:
            self._controlTerminal()

        # standardize terminal size at 24, 80 for those programs that
        # access it.  This should ensure that programs that look at
        # terminal size for displaying log info will look similar across
        # runs.
        self._setTerminalSize(24, 80)

        # set some local variables that are reused often within the loop
        ptyFd = self.ptyFd
        lexer = self.lexer
        stdin = sys.stdin.fileno()
        unLogged = ''

        pollObj = select.poll()
        pollObj.register(ptyFd, select.POLLIN)
        if self.withStdin and os.isatty(stdin):
            pollObj.register(stdin, select.POLLIN)

        # sigwinch is called when the window size is changed
        sigwinch = []
        def sigwinch_handler(s, f):
            sigwinch.append(True)
        # disable to ensure window size is standardized
        #signal.signal(signal.SIGWINCH, sigwinch_handler)

        while True:
            try:
                read = [ x[0] for x in pollObj.poll() ]
            except select.error, msg:
                if msg.args[0] != 4:
                    raise
                read = []

            if ptyFd in read:
                # read output from pseudo terminal stdout/stderr, and pass to
                # terminal and log

                try:
                    output = os.read(ptyFd, BUFFER)
                except __HOLE__, msg:
                    if msg.errno == errno.EIO:
                        # input/output error - pty closed
                        # shut down logger
                        break
                    elif msg.errno != errno.EINTR:
                        # EINTR is due to an interrupted read - that could be
                        # due to a SIGWINCH signal.  Raise any other error
                        raise
                else:
                    lexer.write(output)

            if stdin in read:
                # read input from stdin, and pass to
                # pseudo tty
                try:
                    input = os.read(stdin, BUFFER)
                except OSError, msg:
                    if msg.errno == errno.EIO:
                        # input/output error - stdin closed
                        # shut down logger
                        break
                    elif msg.errno != errno.EINTR:
                        # EINTR is due to an interrupted read - that could be
                        # due to a SIGWINCH signal.  Raise any other error
                        raise
                else:
                    os.write(ptyFd, input)
            if sigwinch:
            #   disable sigwinch to ensure the window width expected in logs is standardized
            #   self._resizeTerminal()
                sigwinch = []
dataset/ETHPy150Open sassoftware/conary/conary/lib/logger.py/_ChildLogger.log