Skip to content

Commit dade7d1

Browse files
committed
More detailed comment about sys.stdin handling.
1 parent d13227b commit dade7d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bpython/urwid.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,16 @@ def sigint(*args):
636636
# before starting it).
637637
def run_with_screen_before_mainloop():
638638
try:
639-
# XXX no stdin for you! What to do here?
639+
# Currently we just set this to None because I do not
640+
# expect code hitting stdin to work. For example: exit()
641+
# (not sys.exit, site.py's exit) tries to close sys.stdin,
642+
# which breaks urwid's shutdown. bpython.cli sets this to
643+
# a fake object that reads input through curses and
644+
# returns it. When using twisted I do not think we can do
645+
# that because sys.stdin.read and friends block, and we
646+
# cannot re-enter the reactor. If using urwid's own
647+
# mainloop we *might* be able to do something similar and
648+
# re-enter its mainloop.
640649
sys.stdin = None #FakeStdin(myrepl)
641650
sys.stdout = myrepl
642651
sys.stderr = myrepl

0 commit comments

Comments
 (0)