~benoit.pierre/bzrtools/shell_improvements

« back to all changes in this revision

Viewing changes to shell.py

  • Committer: Benoît Pierre
  • Date: 2008-11-19 23:36:27 UTC
  • Revision ID: benoit.pierre@gmail.com-20081119233627-m2bxo5xgzn2mj2qx
Allows killing the current command line and start with a new one with ^C
like most shells do (which also helps avoiding to kill the shell by
mistake when one's timing is off when trying to interrupt a command in
progress).

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
def run_shell():
224
224
    try:
225
225
        prompt = PromptCmd()
226
 
        try:
227
 
            prompt.cmdloop()
228
 
        finally:
229
 
            prompt.write_history()
 
226
        while True:
 
227
            try:
 
228
                prompt.cmdloop()
 
229
            except KeyboardInterrupt:
 
230
                print
 
231
            finally:
 
232
                prompt.write_history()
230
233
    except StopIteration:
231
234
        pass
232
235