diff --git a/IPython/terminal/ptshell.py b/IPython/terminal/ptshell.py index 3e52160..e7a8f47 100644 --- a/IPython/terminal/ptshell.py +++ b/IPython/terminal/ptshell.py @@ -3,6 +3,7 @@ from __future__ import print_function import os import sys +import signal from IPython.core.interactiveshell import InteractiveShell from IPython.utils.py3compat import PY3, cast_unicode_py2, input @@ -136,6 +137,12 @@ class TerminalInteractiveShell(InteractiveShell): def _(event): event.current_buffer.reset() + supports_suspend = Condition(lambda cli: hasattr(signal, 'SIGTSTP')) + + @kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend) + def _(event): + event.cli.suspend_to_background() + @Condition def cursor_in_leading_ws(cli): before = cli.application.buffer.document.current_line_before_cursor