"""echo "print 'test'" | bpython""" no longer breaks

bpython now checks if stdin is a tty and, if not, executes stdin through a
simple interpreter instance and exits.
This commit is contained in:
Bob Farrell
2008-12-15 19:33:05 +00:00
parent af1aac9557
commit b8470d6a80
2 changed files with 10 additions and 1 deletions
+7 -1
View File
@@ -45,7 +45,7 @@ import string
import shlex
import socket
import pydoc
import cStringIO
from cStringIO import StringIO
# These are used for syntax hilighting.
from pygments import highlight
@@ -1715,7 +1715,13 @@ def main_curses(scr):
def main():
if not os.isatty(sys.stdin.fileno()):
interpreter = code.InteractiveInterpreter()
interpreter.runsource(sys.stdin.read())
return
tb = None
try:
o = curses.wrapper(main_curses)
except: