1
0
mirror of https://github.com/mnaberez/py65.git synced 2025-02-06 02:31:08 +00:00

Use _exit() instead of calling sys.exit directly

This commit is contained in:
Mike Naberezny 2012-01-04 21:20:00 -08:00
parent 4ec4ae6a8f
commit cf8d0ab394

View File

@ -52,7 +52,7 @@ class Monitor(cmd.Cmd):
except getopt.GetoptError, err:
self._output(str(err))
self.usage()
sys.exit(1)
self._exit()
for opt, value in options:
if opt in ('-l','--load'):
@ -75,7 +75,7 @@ class Monitor(cmd.Cmd):
self.do_mpu(value)
elif opt in ("-h", "--help"):
self.usage()
sys.exit()
self._exit()
def usage(self):
usage = __doc__ % sys.argv[0]
@ -201,6 +201,9 @@ class Monitor(cmd.Cmd):
if stuff is not None:
self.stdout.write(stuff + "\n")
def _exit(self, exitcode=0):
sys.exit(exitcode)
def do_help(self, args):
args = self._shortcuts.get(args.strip(), args)
return cmd.Cmd.do_help(self, args)