Commit f9472a6
authored
[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 seen1 parent 677ce02 commit f9472a6
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments