Skip to content

Commit d178445

Browse files
committed
fix no format output
1 parent 3eccd49 commit d178445

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

runner/runner.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,21 @@ func (r *Runner) Run() error {
4949
}
5050
}
5151

52+
var outputWriters []io.Writer
5253
if r.options.OutputFile != "" {
5354
file, err := os.Create(r.options.OutputFile)
5455
if err != nil {
5556
return err
5657
}
57-
r.options.Output = file
58+
outputWriters = append(outputWriters, file)
5859
}
5960

60-
if r.options.OutputFile != "" && r.options.DisplayInJSON {
61-
r.options.Output = io.MultiWriter(r.options.Output, os.Stdout)
61+
if !r.options.DisplayInCSV {
62+
outputWriters = append(outputWriters, os.Stdout)
6263
}
6364

65+
r.options.Output = io.MultiWriter(outputWriters...)
66+
6467
if r.options.DisplayInCSV {
6568
w := csv.NewWriter(r.options.Output)
6669
w.Comma = '|'

0 commit comments

Comments
 (0)