Skip to content

Commit 2f526a8

Browse files
authored
Use same impl for devbox run in shell or out (#505)
## Summary The new devbox run implementation lets us reuse the exact same implementation, whether we're in or outside a devbox shell. I also behaves exactly the same way, yay! ## How was it tested? ``` ./devbox shell ./devbox run hello ./devbox run echo '$HOME' ```
1 parent 10d7390 commit 2f526a8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

devbox.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type Devbox interface {
3434
// the devbox environment.
3535
Remove(pkgs ...string) error
3636
RunScript(scriptName string, scriptArgs []string) error
37+
// TODO: Deprecate in favor of RunScript
3738
RunScriptInShell(scriptName string) error
3839
Services() (plugin.Services, error)
3940
// Shell generates the devbox environment and launches nix-shell as a child

internal/boxcli/run.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/pkg/errors"
88
"github.com/spf13/cobra"
99
"go.jetpack.io/devbox"
10+
"go.jetpack.io/devbox/internal/boxcli/featureflag"
1011
"go.jetpack.io/devbox/internal/debug"
1112
)
1213

@@ -47,10 +48,14 @@ func runScriptCmd(cmd *cobra.Command, args []string, flags runCmdFlags) error {
4748
return errors.WithStack(err)
4849
}
4950

50-
if devbox.IsDevboxShellEnabled() {
51-
err = box.RunScriptInShell(script)
52-
} else {
51+
if featureflag.StrictRun.Enabled() {
5352
err = box.RunScript(script, scriptArgs)
53+
} else {
54+
if devbox.IsDevboxShellEnabled() {
55+
err = box.RunScriptInShell(script)
56+
} else {
57+
err = box.RunScript(script, scriptArgs)
58+
}
5459
}
5560
return err
5661
}

0 commit comments

Comments
 (0)