Skip to content

Commit

Permalink
Fix bug on teardown of uncessful setup
Browse files Browse the repository at this point in the history
If the console fails to set itself up properly, python will complain
about `console` not existing in the teardown code.  This fixes that
by checking if `console` is not `None` in the teardown code`.
  • Loading branch information
DirectXMan12 committed Mar 11, 2016
1 parent bedcb93 commit f237c8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gssapi-console.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
SAVED_ENV = None

try:
console = None
# import the env
SAVED_ENV = copy.deepcopy(os.environ)
console = GSSAPIConsole(mech_cls, realm_args=realm_args, attach=PARSED_ARGS.attach)
Expand Down Expand Up @@ -91,4 +92,5 @@
else:
del os.environ[k]

console.stop()
if console is not None:
console.stop()

0 comments on commit f237c8e

Please sign in to comment.