Skip to content

Commit 3d9dee8

Browse files
committed
Merge in main branch
2 parents 0c4914b + 4cdfca7 commit 3d9dee8

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

bpython/args.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ def parse(args, extras=None):
8888
raise SystemExit
8989

9090
if not (sys.stdin.isatty() and sys.stdout.isatty()):
91-
interpreter = code.InteractiveInterpreter()
92-
interpreter.runsource(sys.stdin.read())
93-
raise SystemExit
94-
91+
run_stdin(sys.stdin)
9592
path = os.path.expanduser('~/.bpythonrc')
9693
# migrating old configuration file
9794
if os.path.isfile(path):
@@ -113,3 +110,11 @@ def exec_code(interpreter, args):
113110
sys.path.insert(0, os.path.abspath(os.path.dirname(args[0])))
114111
interpreter.runcode(code_obj)
115112
sys.argv = old_argv
113+
114+
def run_stdin(stdin):
115+
"""
116+
Run code from a file-like object and exit.
117+
"""
118+
interpreter = code.InteractiveInterpreter()
119+
interpreter.runsource(stdin.read())
120+
raise SystemExit

bpython/gtk_.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
_COLORS = dict(b='blue', c='cyan', g='green', m='magenta', r='red',
5151
w='white', y='yellow', k='black', d='black')
5252

53+
def run_stdin(stdin):
54+
"""
55+
Overwrite stdin reader from args as GTK does not supply a stdin/stdout
56+
as a tty.
57+
"""
58+
pass
59+
60+
bpython.args.run_stdin = run_stdin
5361

5462
class ArgspecFormatter(object):
5563
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy