Index: Lib/cmd.py =================================================================== --- Lib/cmd.py (revision 58221) +++ Lib/cmd.py (working copy) @@ -130,6 +130,9 @@ line = raw_input(self.prompt) except EOFError: line = 'EOF' + except KeyboardInterrupt: + line = 'KeyboardInterrupt' + else: self.stdout.write(self.prompt) self.stdout.flush() @@ -403,3 +406,13 @@ for col in range(len(texts)): texts[col] = texts[col].ljust(colwidths[col]) self.stdout.write("%s\n"%str(" ".join(texts))) + + def do_EOF(self, args): + """default implementation for EOF""" + self.stdout.write('\n') + return True + + def do_KeyboardInterrupt(self, args): + """default implementation for CTRL-C""" + self.stdout.write('\n') + return False