From 3f6ad5ad7a6e10c0ce3b118bbc9f596601592385 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 12 May 2024 13:25:37 +0200 Subject: [PATCH] fix: fix duplicate command trace --- plugin/impl.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/plugin/impl.go b/plugin/impl.go index 462ab5f..fd32533 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -5,11 +5,9 @@ import ( "encoding/json" "errors" "fmt" - "io" "os" "github.com/thegeeklab/wp-opentofu/tofu" - "github.com/thegeeklab/wp-plugin-go/v2/trace" "github.com/thegeeklab/wp-plugin-go/v2/types" ) @@ -118,22 +116,16 @@ func (p *Plugin) Execute() error { return err } - for _, bc := range batchCmd { - bc.Stdout = os.Stdout - bc.Stderr = os.Stderr - trace.Cmd(bc.Cmd) - - bc.Env = os.Environ() - - if bc.Private { - bc.Stdout = io.Discard + for _, cmd := range batchCmd { + if cmd == nil { + continue } if p.Settings.RootDir != "" { - bc.Dir = p.Settings.RootDir + cmd.Dir = p.Settings.RootDir } - if err := bc.Run(); err != nil { + if err := cmd.Run(); err != nil { return err } }