"""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
+3
View File
@@ -9,6 +9,9 @@ Menno sent me some patches to fix some stuff:
flush_output option added to config to control whether output is flushed to
stdout or not on exit.
Piping something to bpython made it lock up as stdin was not the keyboard -
bpython just executes stdin and exits instead of trying to do something clever.
v0.7.1
======
Added support for a history file, defaults to ~/.pythonhist and 100 lines but
+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: