I have a little cmd subclass:
class Foo(cmd.Cmd):
def do_ipdb(self, *a, **kw):
import ipdb; ipdb.set_trace()
pass
Foo().cmdloop()
This works and lets me inside ipdb, but when exiting, either using 'q' or CTRL-D, the cmdloop also breaks (which is not desired)
I tried wrapping the ipdb with a try / except, but I don't get to the except part. How can I maintain the cmdloop after exiting form ipdb?
BTW, I saw that cmd2 already does what I'm trying to do (with its default python
option), but I still wonder what is happening here in the old cmd
According to the ipdb documentation, ipdb exposes
same interface as the pdb module
The pdb docs for q(uit) state:
Quit from the debugger. The program being executed is aborted.
So when you press 'q', both the debugger and the running program exit.
You may want to use a different pdb command, such as c(ontinue):
Continue execution, only stop when a breakpoint is encountered.