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

[Resolve #1520] Replace hard-coded shell paths #1523

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/test_hooks/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,21 @@ def test_hook_writes_to_stderr(stack, capfd):
def test_default_shell_is_sh(stack, capfd):
Cmd("echo $0", stack).run()
cap = capfd.readouterr()
assert cap.out.strip() == "/bin/sh"
assert cap.out.strip().split("/")[-2:] == ["bin", "sh"]
alex-harvey-z3q marked this conversation as resolved.
Show resolved Hide resolved
assert cap.err.strip() == ""


def test_shell_parameter_sets_the_shell(stack, capfd):
Cmd({"run": "echo $0", "shell": "/bin/bash"}, stack).run()
# Determine the local path to bash (it's not always /bin/bash)
Cmd("echo $0", stack).run()
cap = capfd.readouterr()
assert cap.err.strip() == ""
bash = cap.out.strip()

# Confirm the correct shell is used in the sub-process
Cmd({"run": "echo $0", "shell": bash}, stack).run()
cap = capfd.readouterr()
assert cap.out.strip() == "/bin/bash"
assert cap.out.strip() == bash
assert cap.err.strip() == ""


Expand Down