aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/cli.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-04-06 23:47:33 +0000
committerRob Austein <sra@hactrn.net>2010-04-06 23:47:33 +0000
commit70c9bf49df5a3d4739afee5a05749d2a02c521a7 (patch)
tree0517229382c14c28400d49594b2538015fd0a774 /rpkid/rpki/cli.py
parenta7d6183da7bae9d1d9843fe367043d0f9598a4e0 (diff)
Don't bomb out of command processor if we see an exception.
svn path=/rpkid/rpki/cli.py; revision=3165
Diffstat (limited to 'rpkid/rpki/cli.py')
-rw-r--r--rpkid/rpki/cli.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/rpkid/rpki/cli.py b/rpkid/rpki/cli.py
index 80f8587f..10ace337 100644
--- a/rpkid/rpki/cli.py
+++ b/rpkid/rpki/cli.py
@@ -18,7 +18,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import cmd, glob, os.path
+import cmd, glob, os.path, traceback
try:
import readline
@@ -46,6 +46,18 @@ class Cmd(cmd.Cmd):
else:
self.cmdloop_with_history()
+ def onecmd(self, line):
+ """
+ Wrap error handling around cmd.Cmd.onecmd(). Might want to do
+ something kinder than showing a traceback, eventually.
+ """
+ try:
+ return cmd.Cmd.onecmd(self, line)
+ except SystemExit:
+ raise
+ except:
+ traceback.print_exc()
+
def do_EOF(self, arg):
"""
Exit program.