summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2020-09-09 21:59:31 -0400
committerZane Bitter <zbitter@redhat.com>2020-09-09 21:59:31 -0400
commitbc92b0fd92b1a71902382b707014d1118f9361b1 (patch)
treebd2c1d863fdf0f164ed331b12e44014472c7be89
parentfe7475d6c5b8ede7fb4e41ffc320f4cbbf5b1624 (diff)
downloadcliff-bc92b0fd92b1a71902382b707014d1118f9361b1.tar.gz
Document KeyboardInterrupt exit code
Change-Id: Ib97cbf2c9b108932c437a6d69a6ab629244702b3
-rw-r--r--cliff/app.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/cliff/app.py b/cliff/app.py
index 5fae225..88b39d2 100644
--- a/cliff/app.py
+++ b/cliff/app.py
@@ -32,6 +32,10 @@ from . import utils
logging.getLogger('cliff').addHandler(logging.NullHandler())
+# Exit code for exiting due to a signal is 128 + the signal number
+_SIGINT_EXIT = 130
+
+
class App(object):
"""Application base class.
@@ -277,7 +281,7 @@ class App(object):
self.LOG.error(err)
return 1
except KeyboardInterrupt:
- return 130
+ return _SIGINT_EXIT
result = 1
if self.interactive_mode:
result = self.interact()
@@ -285,7 +289,7 @@ class App(object):
try:
result = self.run_subcommand(remainder)
except KeyboardInterrupt:
- return 130
+ return _SIGINT_EXIT
return result
# FIXME(dhellmann): Consider moving these command handling methods
@@ -418,7 +422,7 @@ class App(object):
else:
self.LOG.error(err)
except KeyboardInterrupt as err1:
- result = 130
+ result = _SIGINT_EXIT
err = err1
raise
finally: