Skip to content

Commit 378c6fa

Browse files
theazureshadowuntitaker
authored andcommitted
Handle click.exceptions.Exit, introduced in Click 7.0 (#51)
1 parent 948fb24 commit 378c6fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

click_repl/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
import six
1212
from .exceptions import InternalCommandException, ExitReplException # noqa
1313

14+
# Handle click.exceptions.Exit introduced in Click 7.0
15+
try:
16+
from click.exceptions import Exit as ClickExit
17+
except ImportError:
18+
class ClickExit(RuntimeError):
19+
pass
1420

1521
PY2 = sys.version_info[0] == 2
1622

@@ -243,6 +249,8 @@ def get_command():
243249
ctx.exit()
244250
except click.ClickException as e:
245251
e.show()
252+
except ClickExit:
253+
pass
246254
except SystemExit:
247255
pass
248256
except ExitReplException:

0 commit comments

Comments
 (0)