From 67ad29e8e5a7c9457d6de21cf657fcb71bd69c2d Mon Sep 17 00:00:00 2001 From: Giuseppe De Palma Date: Thu, 14 Sep 2023 17:00:33 +0200 Subject: [PATCH] fix: disable nuv integration during testing --- interp/builtin.go | 8 +++++--- interp/interp_test.go | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/interp/builtin.go b/interp/builtin.go index e9680343..c344164a 100644 --- a/interp/builtin.go +++ b/interp/builtin.go @@ -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 { @@ -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...) diff --git a/interp/interp_test.go b/interp/interp_test.go index 1cef1e8e..82d998b9 100644 --- a/interp/interp_test.go +++ b/interp/interp_test.go @@ -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