Skip to content

Commit

Permalink
fix: disable nuv integration during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
giusdp committed Sep 14, 2023
1 parent ab2f2a7 commit 67ad29e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions interp/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import (
"github.com/nuvolaris/sh/v3/syntax"
)

var NuvIntegrationEnabled = true

func isBuiltin(name string) bool {
if tools.IsTool(name) {
if tools.IsTool(name) && NuvIntegrationEnabled {
return true
}
switch name {
Expand Down Expand Up @@ -54,10 +56,10 @@ func atoi(s string) int {
}

func (r *Runner) builtinCode(ctx context.Context, pos syntax.Pos, name string, args []string) int {
if tools.IsTool(name) {
if tools.IsTool(name) && NuvIntegrationEnabled {
me := tools.GetNuvCmd()
if me == "" {
r.errf("both NuvCmd and NUVCMD are empty\n")
r.errf("both NuvCmd and NUVCMD are empty %s\n", name)
return 1
}
cmd := append([]string{me, "-" + name}, args...)
Expand Down
4 changes: 4 additions & 0 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import (
"github.com/nuvolaris/sh/v3/syntax"
)

func init() {
interp.NuvIntegrationEnabled = false
}

// runnerRunTimeout is the context timeout used by any tests calling Runner.Run.
// The timeout saves us from hangs or burning too much CPU if there are bugs.
// All the test cases are designed to be inexpensive and stop in a very short
Expand Down

0 comments on commit 67ad29e

Please sign in to comment.