Skip to content

Commit f237c8e

Browse files
committed
Fix bug on teardown of uncessful setup
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`.
1 parent bedcb93 commit f237c8e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gssapi-console.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
SAVED_ENV = None
6161

6262
try:
63+
console = None
6364
# import the env
6465
SAVED_ENV = copy.deepcopy(os.environ)
6566
console = GSSAPIConsole(mech_cls, realm_args=realm_args, attach=PARSED_ARGS.attach)
@@ -91,4 +92,5 @@
9192
else:
9293
del os.environ[k]
9394

94-
console.stop()
95+
if console is not None:
96+
console.stop()

0 commit comments

Comments
 (0)