summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2018-01-03 10:08:50 +0100
committerChristian Heimes <cheimes@redhat.com>2018-01-09 07:53:28 +0100
commit1ed4461f338e456837bb074602dd76e0f0bd5b10 (patch)
treeaf177436c3b0a93946f0cc1de832a8f76dfc0db1 /ipalib
parentcae2d99f89d940d2554a82f8ca1bbfeb1f46d336 (diff)
downloadfreeipa-1ed4461f338e456837bb074602dd76e0f0bd5b10.tar.gz
freeipa-1ed4461f338e456837bb074602dd76e0f0bd5b10.tar.xz
freeipa-1ed4461f338e456837bb074602dd76e0f0bd5b10.zip
LGTM: Use of exit() or quit()
Replace exit() with sys.exit(). exit() or quit() may fail if the interpreter is run with the -S option. https://pagure.io/freeipa/issue/7344 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 625096a38..2da641046 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -956,13 +956,13 @@ class console(frontend.Command):
try:
script = open(filename)
except IOError as e:
- exit("%s: %s" % (e.filename, e.strerror))
+ sys.exit("%s: %s" % (e.filename, e.strerror))
try:
with script:
exec(script, globals(), local)
except Exception:
traceback.print_exc()
- exit(1)
+ sys.exit(1)
else:
code.interact(
'(Custom IPA interactive Python console)',
@@ -1121,7 +1121,7 @@ class cli(backend.Executioner):
self.Command.help(outfile=sys.stderr)
print(file=sys.stderr)
print('Error: Command not specified', file=sys.stderr)
- exit(2)
+ sys.exit(2)
(key, argv) = (argv[0], argv[1:])
name = from_cli(key)
if name not in self.Command and len(argv) == 0: