Skip to content

Commit

Permalink
fix: env validation when missing fish script (#427)
Browse files Browse the repository at this point in the history
env validation was failing when the `activate-hermit.fish` script was
missing due to matching on path instead of filename. Not sure why
integration tests didn't catch it. Will follow up later with a test.
  • Loading branch information
mightyguava authored Jan 5, 2025
1 parent 48b4034 commit 72d1cd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/docs/usage/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ in order for the changes to take effect.

```shell
hermit shell-hooks --fish
````
```
6 changes: 3 additions & 3 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ func (e *Env) Root() string {
// Verify contains valid Hermit scripts.
func (e *Env) Verify() error {
next:
for _, path := range []string{"activate-hermit", "activate-hermit.fish", "hermit"} {
path = filepath.Join(e.binDir, path)
for _, file := range []string{"activate-hermit", "activate-hermit.fish", "hermit"} {
path := filepath.Join(e.binDir, file)
hasher := sha256.New()
r, err := os.Open(path)
if os.IsNotExist(err) {
if path == "activate-hermit.fish" {
if file == "activate-hermit.fish" {
// Fish support was added later. Older hermit envs won't have it.
continue next
}
Expand Down

0 comments on commit 72d1cd4

Please sign in to comment.