0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-06-03 04:49:42 +02: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"
"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
}
}