Skip to content

Commit

Permalink
Merge pull request #1263 from onflow/bjartek/creates-empty-dir-when-s…
Browse files Browse the repository at this point in the history
…aving-output

create paths if they do not exist
  • Loading branch information
turbolent authored Nov 11, 2023
2 parents c698757 + 4a516c4 commit 0bf7d97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/command/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func outputResult(result string, saveFlag string, formatFlag string, filterFlag
Fs: afero.NewOsFs(),
}

err := af.MkdirAll(saveFlag, 0644)
if err != nil {
return err
}

fmt.Printf("%s result saved to: %s \n", output.SaveEmoji(), saveFlag)
return af.WriteFile(saveFlag, []byte(result), 0644)
}
Expand Down

0 comments on commit 0bf7d97

Please sign in to comment.