Skip to content

Commit

Permalink
Updates nil check for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Dec 10, 2023
1 parent 4414fe9 commit 02331fe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,14 @@ func (c *PrintMsg) Execute(exCtx ExecutionContext) (Executer, error) {

fmt.Fprintf(exCtx.Output(), "%s\n", output)

if !reflect.ValueOf(exCtx.OutputFile()).IsNil() {
outputFile := exCtx.OutputFile()
if outputFile != nil && !reflect.ValueOf(outputFile).IsNil() {
output, err := exCtx.Formater().FormatForFile(msg)
if err != nil {
return nil, err
}

_, err = fmt.Fprintln(exCtx.OutputFile(), output)
_, err = fmt.Fprintln(outputFile, output)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 02331fe

Please sign in to comment.