command.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:jiveplot 作者: haavee 项目源码 文件源码
def next(self):
        try:
            l = raw_input(self.prompt+"> ")
            if self.controlc:
                #rl_done.value = 0
                self.controlc = None
                return None
            return l
        except (EOFError):
            quit = True
            print "\nKTHXBYE!"
        except KeyboardInterrupt:
            # user pressed ctrl-c whilst something was 
            # in the buffer. Make the code skip the next line of input.
            if len(readline.get_line_buffer())>0:
                #self.controlc = readline.get_line_buffer()
                self.controlc = True
                #print "rlbuf: ",rl_line_buffer.value
                #rl_line_buffer.value = ""
                #print "rl_done = ",rl_done
                #rl_done.value = 1
                #print "rl_done = ",rl_done
                print "\nYour next line of input might be ignored.\nI have not understood readline's ^C handling good enough to make it work.\nFor the moment just type <enter> and ignore the displayed text."
            return None
        if quit:
            raise StopIteration
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号