{"action":"created","issue":{"url":"https://api.github.com/repos/scopatz/xonsh/issues/91","labels_url":"https://api.github.com/repos/scopatz/xonsh/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/scopatz/xonsh/issues/91/comments","events_url":"https://api.github.com/repos/scopatz/xonsh/issues/91/events","html_url":"https://github.com/scopatz/xonsh/issues/91","id":62762406,"number":91,"title":"KeyboardInterrupt is never cleared","user":{"login":"mbollmann","id":11348502,"avatar_url":"https://avatars.githubusercontent.com/u/11348502?v=3","gravatar_id":"","url":"https://api.github.com/users/mbollmann","html_url":"https://github.com/mbollmann","followers_url":"https://api.github.com/users/mbollmann/followers","following_url":"https://api.github.com/users/mbollmann/following{/other_user}","gists_url":"https://api.github.com/users/mbollmann/gists{/gist_id}","starred_url":"https://api.github.com/users/mbollmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbollmann/subscriptions","organizations_url":"https://api.github.com/users/mbollmann/orgs","repos_url":"https://api.github.com/users/mbollmann/repos","events_url":"https://api.github.com/users/mbollmann/events{/privacy}","received_events_url":"https://api.github.com/users/mbollmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-18T18:07:08Z","updated_at":"2015-03-19T00:27:30Z","closed_at":null,"body":"When a KeyboardInterrupt occurs, it seems to appear in every further exception raised:\r\n\r\n```bash\r\nbollmann@underberg ~/repositories/xonsh master >>> # ^C here\r\nbollmann@underberg ~/repositories/xonsh master >>> [1,2,3][4]\r\nTraceback (most recent call last):\r\n  File \"/home/bollmann/repositories/xonsh/xonsh/shell.py\", line 154, in cmdloop\r\n    super(Shell, self).cmdloop(intro=intro)\r\n  File \"/usr/lib/python3.4/cmd.py\", line 126, in cmdloop\r\n    line = input(self.prompt)\r\nKeyboardInterrupt\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/home/bollmann/repositories/xonsh/xonsh/shell.py\", line 111, in default\r\n    self.execer.exec(code, mode='single', glbs=self.ctx)  # no locals\r\n  File \"/home/bollmann/repositories/xonsh/xonsh/execer.py\", line 110, in exec\r\n    return exec(code, glbs, locs)\r\n  File \"<xonsh-code>\", line 1, in <module>\r\nIndexError: list index out of range\r\n```\r\n\r\nRepeat the last command and it will show the KeyboardInterrupt every time, although CTRL+C was never pressed again.\r\n\r\nAdditionally, if you do ^C more than once, it will show the stacktrace for KeyboardInterrupt for each time you pressed it.\r\n\r\nThis happens both when you do ^C on an empty line, and when you use it to actually interrupt a running process/function."},"comment":{"url":"https://api.github.com/repos/scopatz/xonsh/issues/comments/83233178","html_url":"https://github.com/scopatz/xonsh/issues/91#issuecomment-83233178","issue_url":"https://api.github.com/repos/scopatz/xonsh/issues/91","id":83233178,"user":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"created_at":"2015-03-19T00:27:30Z","updated_at":"2015-03-19T00:27:30Z","body":"The fix might be to call `RL_LIB.rl_reset_line_state()` whenever an KeyboardInterrupt happens.  Can you play around with this and see if it works?"}}