Skip to content

Commit

Permalink
fix: fix duplicate command trace
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed May 12, 2024
1 parent dcc53a3 commit 3f6ad5a
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions plugin/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 3f6ad5a

Please sign in to comment.