Skip to content

Commit

Permalink
Don't output to stdout by default
Browse files Browse the repository at this point in the history
Signed-off-by: Dominique Vernier <[email protected]>
  • Loading branch information
itdove committed Jun 8, 2021
1 parent 2028c84 commit 5770641
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/helpers/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ func IsEmptyAsset(err error) bool {
}

func WriteOutput(fileName string, output []string) (err error) {
f := os.Stdout
if fileName != "" {
f, err = os.OpenFile(filepath.Clean(fileName), os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return err
}
defer f.Close()
if fileName == "" {
return nil
}
f, err := os.OpenFile(filepath.Clean(fileName), os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return err
}
defer f.Close()
for _, s := range output {
_, err := f.WriteString(fmt.Sprintf("%s\n---\n", s))
if err != nil {
Expand Down

0 comments on commit 5770641

Please sign in to comment.