summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-24 12:12:22 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-24 12:12:22 -0400
commit7643058382e586ccc2a5355a35be49107b760be6 (patch)
tree5d0ad5c108ea302318705f5cc91b9ca49854af0c /cmd2/cmd2.py
parent11e3eabbff8f80c9c85c04b7e9d6071246856bcf (diff)
parent8c0abd3c1adb204737851c06cb9eeba16791f2c4 (diff)
downloadcmd2-git-7643058382e586ccc2a5355a35be49107b760be6.tar.gz
Merge branch 'master' into quoted_args
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index be672465..6d76ac2b 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -523,6 +523,9 @@ class Cmd(cmd.Cmd):
# This boolean flag determines whether or not the cmd2 application can interact with the clipboard
self.can_clip = can_clip
+ # This determines if a non-zero exit code should be used when exiting the application
+ self.exit_code = None
+
# ----- Methods related to presenting output to the user -----
@property
@@ -3235,6 +3238,9 @@ Script should contain one command per line, just like command would be typed in
func()
self.postloop()
+ if self.exit_code is not None:
+ sys.exit(self.exit_code)
+
###
#
# plugin related functions