-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Description
Is there a way for an application to signal to prompt_toolkit
that it should pretend an EOF has happened (typically making the application exit)? Something like this works with readline
but not with prompt_toolkit
:
In [1]: import os; f = open(os.devnull); os.dup2(f.fileno(), 0)
In [2]:
Traceback (most recent call last):
File "/usr/local/src/sage-config/local/bin/ipython", line 5, in <module>
start_ipython()
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/__init__.py", line 119, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/traitlets/config/application.py", line 596, in launch_instance
app.start()
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 348, in start
self.shell.mainloop()
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 402, in mainloop
self.interact()
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 385, in interact
code = self.prompt_for_code()
File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 321, in prompt_for_code
pre_run=self.pre_prompt, reset_current_buffer=True)
File "build/bdist.linux-x86_64/egg/prompt_toolkit/interface.py", line 385, in run
with self.input.raw_mode():
File "build/bdist.linux-x86_64/egg/prompt_toolkit/input.py", line 69, in raw_mode
return raw_mode(self.stdin.fileno())
File "build/bdist.linux-x86_64/egg/prompt_toolkit/terminal/vt100_input.py", line 409, in __init__
self.attrs_before = termios.tcgetattr(fileno)
error: (25, 'Inappropriate ioctl for device')
My use case is a signal handler forcing the application to exit gracefully.
Metadata
Metadata
Assignees
Labels
No labels