title: How to exit the cmd loop of cmd module cleanly
body: <p>I'm using the <code>cmd</code> module in Python to build a little interactive command-line program. However, from this documentation: <a href="http://docs.python.org/2/library/cmd.html" rel="noreferrer">http://docs.python.org/2/library/cmd.html</a>, it is not clear that what is a clean way to exit the program (i.e. the cmdloop) programmatically.</p>
  
  <p>Ideally, I want to issue some command <code>exit</code> on the prompt, and that will exit the program.</p>