Skip to content

Commit

Permalink
fix: not informed out iostream return error
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwelbm committed Jul 3, 2024
1 parent 1c22fd2 commit 3a0a03f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ func Execute() {

if err != nil {
output.Print(&output.ErrorOutput{
GeneralOutput: output.GeneralOutput{Flags: factory.Flags},
Err: err,
GeneralOutput: output.GeneralOutput{
Out: streams.Out,
Flags: factory.Flags,
},
Err: err,
})
}
}
3 changes: 0 additions & 3 deletions pkg/cmdutil/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ package cmdutil

import (
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
)

func WriteDetailsToFile(data []byte, outPath string) error {
fmt.Println(">>> data", string(data))
fmt.Println(">>> outPath", outPath)
err := os.MkdirAll(filepath.Dir(outPath), os.ModePerm)
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions pkg/output/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func format(v any, g GeneralOutput) error {
}
}

fmt.Println(">>> str", string(b))

if len(g.Flags.Out) > 0 {
err = cmdutil.WriteDetailsToFile(b, g.Flags.Out)
if err != nil {
Expand Down

0 comments on commit 3a0a03f

Please sign in to comment.