Show More
@@ -9,7 +9,7 b' from IPython.core.interactiveshell import InteractiveShell' | |||
|
9 | 9 | from IPython.utils.py3compat import PY3, cast_unicode_py2, input |
|
10 | 10 | from IPython.utils.terminal import toggle_set_term_title, set_term_title |
|
11 | 11 | from IPython.utils.process import abbrev_cwd |
|
12 | from traitlets import Bool, Unicode, Dict | |
|
12 | from traitlets import Bool, CBool, Unicode, Dict | |
|
13 | 13 | |
|
14 | 14 | from prompt_toolkit.completion import Completer, Completion |
|
15 | 15 | from prompt_toolkit.enums import DEFAULT_BUFFER |
@@ -72,6 +72,12 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
72 | 72 | |
|
73 | 73 | pt_cli = None |
|
74 | 74 | |
|
75 | confirm_exit = CBool(True, config=True, | |
|
76 | help=""" | |
|
77 | Set to confirm when you try to exit IPython with an EOF (Control-D | |
|
78 | in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit', | |
|
79 | you can force a direct exit without any confirmation.""", | |
|
80 | ) | |
|
75 | 81 | vi_mode = Bool(False, config=True, |
|
76 | 82 | help="Use vi style keybindings at the prompt", |
|
77 | 83 | ) |
@@ -282,7 +288,8 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
282 | 288 | try: |
|
283 | 289 | code = self.prompt_for_code() |
|
284 | 290 | except EOFError: |
|
285 | if self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): | |
|
291 | if (not self.confirm_exit) \ | |
|
292 | or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): | |
|
286 | 293 | self.ask_exit() |
|
287 | 294 | |
|
288 | 295 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now