Closed Freed-Wu closed 1 year ago
https://github.com/infertux/bashcov/blob/master/lib/bashcov.rb#L79
Why not get bash path from env bash
?
https://github.com/infertux/bashcov/blob/master/lib/bashcov.rb#L79
Why not get bash path from
env bash
?
The main issue with using env
is that you cannot pass arguments to bash
that way, e.g. /usr/bin/env bash -eu
doesn't work. You need to call set -eu
as a separate command. This would also fail here.
I started working on it in this commit however the build is still failing. I don't have more time for this at the moment so feel free to continue the work in the pr-72
branch, either here or on GitLab to run tests with GitLab CI. You can also run tests locally with the ./test.sh
script in the repo.
The main issue with using env is that you cannot pass arguments to bash that way, e.g. /usr/bin/env bash -eu doesn't work. You need to call set -eu as a separate command. This would also fail here.
I think it should be /usr/bin/env -S bash -eu
.
Superseded by #74
Bashcov 3.0.3 has been released, please give it a try.
@infertux -- the changes in this PR are still needed, I think.
@tomeon It's only touching test files so we only need it if we want to run the test suite on NixOS. I assumed we wouldn't but now that we have GitHub Actions set up, is there a way to leverage it and run the tests under NixOS as well?
[I]s there a way to leverage [GitHub Actions] and run the tests under NixOS as well?
There sure is :). I will see about adding it to the nix-support
branch.
FWIW, NixOS is my distro of choice these days, so the updated shebangs are helpful for my development workflow. Anyway, better portability is better portability :).
However! Switching from #!/bin/bash
to #!/usr/bin/env bash
in the test suite is neither necessary nor sufficient to solve "file not found" errors when running the test suite in the Nix build sandbox while constructing a Nix package of Bashcov. The build sandbox provides neither /bin/bash
nor /usr/bin/env
. Instead, I've use the patchShebangs
hook function from the Nixpkgs standard environment to fix up the test scripts' shebangs prior to running RSpec and Cucumber tests.
@Freed-Wu -- if you are a Nix flakes user, I'd be much obliged if you could check out the nix-support
branch.
check out the nix-support branch.
nix build
can work. :+1:
NixOS doesn't have /bin/bash. Replace it by
/usr/bin/env bash
.