diff --git a/CHANGELOG b/CHANGELOG index 042f406..e77e003 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/bpython/cli.py b/bpython/cli.py index 5ef803b..e243815 100644 --- a/bpython/cli.py +++ b/bpython/cli.py @@ -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: