Skip to content

Commit 45c670b

Browse files
authored
Fix devbox run for fish and possibly other shells (#464)
## Summary For shells that aren't fully detected and for which we don't have custom logic (like fish), we fallback to just running the shell. `devbox run` was failing to attempt to run any command in this case. This PR makes it so that we at least attempt to run the command. It may or may not work, depending on the shell, but it does work with fish. This is a bit of a hacky fix to get fish to work. Longer-term I want to re-implement devbox run so it doesn't depend on specific shells and rcfiles, so we can avoid these compatibility problems altogether. ## How was it tested? ``` SHELL=fish ./devbox run <script> ```
1 parent fde296a commit 45c670b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/nix/shell.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ func (s *Shell) execCommand() string {
272272
// override the shellrc file, so just launch the shell without any
273273
// additional args.
274274
if s.userShellrcPath == "" {
275-
return strings.Join(append(args, s.binPath), " ")
275+
args = append(args, s.binPath)
276+
if s.ScriptCommand != "" {
277+
args = append(args, "-ic", shellescape.Quote(s.ScriptCommand))
278+
}
279+
return strings.Join(args, " ")
276280
}
277281

278282
// Create a devbox shellrc file that runs the user's shellrc + the shell

0 commit comments

Comments
 (0)