Skip to content

Commit 7796d01

Browse files
authored
[fish] use fish hooks file for devbox.EnvExports (used in shellenv) (#1756)
## Summary I was getting shell script parsing errors when doing `devbox global shellenv --init-hook | source` in fish Turns out, we were sourcing the init-hook file for non-fish. This PR fixes that ## How was it tested? Ran the above command succesfully in a fish shell
1 parent 5585d21 commit 7796d01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/devbox/devbox.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,13 @@ func (d *Devbox) EnvExports(ctx context.Context, opts devopt.EnvExportsOpts) (st
325325
envStr := exportify(envs)
326326

327327
if opts.RunHooks {
328-
hooksStr := ". " + shellgen.ScriptPath(d.ProjectDir(), shellgen.HooksFilename)
328+
hooksFilename := shellgen.HooksFilename
329+
if isFishShell() {
330+
hooksFilename = shellgen.HooksFishFilename
331+
}
332+
333+
hooksStr := ". " + shellgen.ScriptPath(d.ProjectDir(), hooksFilename)
334+
329335
envStr = fmt.Sprintf("%s\n%s;\n", envStr, hooksStr)
330336
}
331337

0 commit comments

Comments
 (0)