Skip to content

Commit

Permalink
Fix devbox run for fish and possibly other shells (#464)
Browse files Browse the repository at this point in the history
## 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>
```
  • Loading branch information
ipince authored Jan 12, 2023
1 parent fde296a commit 45c670b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/nix/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ func (s *Shell) execCommand() string {
// override the shellrc file, so just launch the shell without any
// additional args.
if s.userShellrcPath == "" {
return strings.Join(append(args, s.binPath), " ")
args = append(args, s.binPath)
if s.ScriptCommand != "" {
args = append(args, "-ic", shellescape.Quote(s.ScriptCommand))
}
return strings.Join(args, " ")
}

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

0 comments on commit 45c670b

Please sign in to comment.