Skip to content

Conversation

@mikeland73
Copy link
Collaborator

Summary

Fixes #1651

How was it tested?

Added a devbox run echo foobar into our init hook. Tested with

devbox run echo 123
SHELL=fish devbox run echo 123

@mikeland73 mikeland73 requested review from ipince and savil January 9, 2024 01:11
@mikeland73 mikeland73 merged commit 2ce087f into main Jan 9, 2024
@mikeland73 mikeland73 deleted the landau/prevent-init-hook-recursion branch January 9, 2024 20:59
mikeland73 added a commit that referenced this pull request Jan 9, 2024
## Summary

Fixes an issue with #1709

Also, adds a `FISH_VERSION` check which seems more reliable? (See
fish-shell/fish-shell#374)

I think longer term it may be better to generate different init hooks
(e.g. `.hooks.fish`) instead.

## How was it tested?

```
SHELL=fish devbox shell
refresh
```
mikeland73 added a commit that referenced this pull request Jan 23, 2024
## Summary

Fixes issue introduced in #1709

`devbox run` uses `sh` instead of native shell. So init hooks must
always be `sh` compatible for `run`. On the other hand, `devbox shell`
uses native shell so init hooks must be `fish` if the native shell is
fish.

This is ugly, but it's how it has always worked. 

#1709 introduced recursion
protection that would be `fish` or `sh` depending on native shell. This
worked fine for `devbox shell` but would break `devbox run`.

This change fixes that by creating 2 hooks files, one fish and one sh
and sourcing the correct one in shellrc, while still always using the
`sh` for run.

cc: @Lagoja 

## How was it tested?

```
devbox run echo 5
devbox shell
SHELL=fish devbox run echo 5
SHELL=fish devbox shell
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Infinite init_hook execution if devbox services start is called

3 participants