0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-23 17:10:38 +00:00

fix: fix duplicate command trace

This commit is contained in:
Robert Kaussow 2024-05-12 13:25:37 +02:00
parent dcc53a341d
commit 3f6ad5ad7a
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0

View File

@ -5,11 +5,9 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io"
"os" "os"
"github.com/thegeeklab/wp-opentofu/tofu" "github.com/thegeeklab/wp-opentofu/tofu"
"github.com/thegeeklab/wp-plugin-go/v2/trace"
"github.com/thegeeklab/wp-plugin-go/v2/types" "github.com/thegeeklab/wp-plugin-go/v2/types"
) )
@ -118,22 +116,16 @@ func (p *Plugin) Execute() error {
return err return err
} }
for _, bc := range batchCmd { for _, cmd := range batchCmd {
bc.Stdout = os.Stdout if cmd == nil {
bc.Stderr = os.Stderr continue
trace.Cmd(bc.Cmd)
bc.Env = os.Environ()
if bc.Private {
bc.Stdout = io.Discard
} }
if p.Settings.RootDir != "" { 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 return err
} }
} }