mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 15:40:17 +00:00
"""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:
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user