{"action":"opened","issue":{"url":"https://api.github.com/repos/jonathanslenders/python-prompt-toolkit/issues/392","repository_url":"https://api.github.com/repos/jonathanslenders/python-prompt-toolkit","labels_url":"https://api.github.com/repos/jonathanslenders/python-prompt-toolkit/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/jonathanslenders/python-prompt-toolkit/issues/392/comments","events_url":"https://api.github.com/repos/jonathanslenders/python-prompt-toolkit/issues/392/events","html_url":"https://github.com/jonathanslenders/python-prompt-toolkit/issues/392","id":176582486,"number":392,"title":"Fake EOF?","user":{"login":"jdemeyer","id":3625785,"avatar_url":"https://avatars.githubusercontent.com/u/3625785?v=3","gravatar_id":"","url":"https://api.github.com/users/jdemeyer","html_url":"https://github.com/jdemeyer","followers_url":"https://api.github.com/users/jdemeyer/followers","following_url":"https://api.github.com/users/jdemeyer/following{/other_user}","gists_url":"https://api.github.com/users/jdemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/jdemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdemeyer/subscriptions","organizations_url":"https://api.github.com/users/jdemeyer/orgs","repos_url":"https://api.github.com/users/jdemeyer/repos","events_url":"https://api.github.com/users/jdemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/jdemeyer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-13T08:38:17Z","updated_at":"2016-09-13T08:38:17Z","closed_at":null,"body":"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`:\r\n```\r\nIn [1]: import os; f = open(os.devnull); os.dup2(f.fileno(), 0)\r\n\r\nIn [2]:      \r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/sage-config/local/bin/ipython\", line 5, in <module>\r\n    start_ipython()\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/__init__.py\", line 119, in start_ipython\r\n    return launch_new_instance(argv=argv, **kwargs)\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/traitlets/config/application.py\", line 596, in launch_instance\r\n    app.start()\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py\", line 348, in start\r\n    self.shell.mainloop()\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py\", line 402, in mainloop\r\n    self.interact()\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py\", line 385, in interact\r\n    code = self.prompt_for_code()\r\n  File \"/usr/local/src/sage-config/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py\", line 321, in prompt_for_code\r\n    pre_run=self.pre_prompt, reset_current_buffer=True)\r\n  File \"build/bdist.linux-x86_64/egg/prompt_toolkit/interface.py\", line 385, in run\r\n    with self.input.raw_mode():\r\n  File \"build/bdist.linux-x86_64/egg/prompt_toolkit/input.py\", line 69, in raw_mode\r\n    return raw_mode(self.stdin.fileno())\r\n  File \"build/bdist.linux-x86_64/egg/prompt_toolkit/terminal/vt100_input.py\", line 409, in __init__\r\n    self.attrs_before = termios.tcgetattr(fileno)\r\nerror: (25, 'Inappropriate ioctl for device')\r\n```\r\n\r\nMy use case is a signal handler forcing the application to exit gracefully."}}
{"actor":{"display_login":"jdemeyer"}}