Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-interactive with param -i in subprocess #2557

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -110,3 +110,4 @@
* Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
* Joseph LaFreniere <joseph@lafreniere.xyz>
* Daniel Tan <danieltanfh95@gmail.com>
* Zhan Tang <tz59pk@gmail.com>
5 changes: 1 addition & 4 deletions hy/cmdline.py
Expand Up @@ -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="<stdin>")
elif action == "run_script_file":
sys.argv = argv
Expand Down
4 changes: 4 additions & 0 deletions tests/test_bin.py
Expand Up @@ -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
Expand Down