gpython: Handle program on stdin through just read+exec
Not through interactive console, because it was printing prompts, while `python <prog.py` does not emit anything: $ cat prog.py print 'Hello World' $ python <prog.py Hello World $ gpython <prog.py Python 2.7.18 (default, Apr 20 2020, 20:30:41) [GCC 9.3.0] [GPython 0.0.8] [gevent 20.9.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) Hello World After the patch gpython output is the same as of python: $ gpython <prog.py Hello World Test coverage for interactive mode is pending. We'll add them soon in a follow-up patch after implementing -i. For _interact - by this patch logic - we should be dropping custom raw_input, since now _interact is called only when sys.stdin is tty. But we'll soon be invoking _interact when stdin is not a tty (for `gpython -i <prog.py`), so leave that logic in place as is. /reviewed-by @jerome /reviewed-on nexedi/pygolang!15
Showing
Please register or sign in to comment