diff --git a/AUTHORS b/AUTHORS index 9702eadb7..2c191a5e6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -110,3 +110,4 @@ * Andrey Vlasovskikh * Joseph LaFreniere * Daniel Tan +* Zhan Tang diff --git a/hy/cmdline.py b/hy/cmdline.py index a7d748008..fc77a7281 100644 --- a/hy/cmdline.py +++ b/hy/cmdline.py @@ -262,10 +262,7 @@ def proc_opt(opt, arg=None, item=None, i=None): return 0 elif action == "run_script_stdin": sys.argv = argv - if repl: - source = sys.stdin - filename = 'stdin' - else: + if not repl: return run_command(sys.stdin.read(), filename="") elif action == "run_script_file": sys.argv = argv diff --git a/tests/test_bin.py b/tests/test_bin.py index 93926363e..dc584040c 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -79,6 +79,10 @@ def test_stdin(): assert "RS" in out assert "TU" in out + # With it, the REPL variable must exists, like ps1 + out, _ = run_cmd("hy -i", '(import sys) (bool (getattr sys "ps1" sys.flags.interactive))') + assert "True" in out + def test_error_parts_length(): """Confirm that exception messages print arrows surrounding the affected