You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[direnv] add quotations around devbox-shellenv-init-hook call (#913)
## Summary
@Lagoja is reporting an error of the form:
```
./.envrc:8: go: command not found
```
In our generated code we have `eval $(devbox shellenv --init-hook)`.
The error is occuring because bash is executing the `devbox shellenv
--init-hook` prior
to doing the eval. Any `$(<bash command>)` within the output of `devbox
shellenv`
will also be eagerly evaluated (via bash command substituion) prior to
the
final `eval`.
With the change: we add quotations around the `$(devbox shellenv
--init-hook)` so
that the `eval` operation will execute the `devbox shellenv
--init-hook`. And `eval`
each line in the output as it goes.
This way, a line in our init-hook like `export GOROOT="(go env GOROOT)"`
will have access to the `go`
binary prior to `go env GOROOT` being executed (a prior line from
`devbox shellenv` adds the
`go` binary to `PATH`).
## How was it tested?
1. removed `go` from my zshrc `PATH`.
2. did `rm .envrc` and `direnv revoke .` to reset.
3. `devbox generate direnv` and `direnv allow .`
4. `cd ..` to exit directory and `cd devbox` to enter directory
BEFORE: saw error above
AFTER: no error seen
0 commit comments