Skip to content

Commit

Permalink
Fixes encoding for Sarif as well (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfs authored Oct 19, 2022
1 parent eb71db3 commit cf5c3b8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ public override void FlushAndClose()

if (OutputPath is string)
{
TextWriter.Close();
File.Delete(OutputPath);
sarifLog.Save(OutputPath);
if (TextWriter is StreamWriter streamWriter)
{
sarifLog.Save(streamWriter);
}
else
{
TextWriter.Close();
File.Delete(OutputPath);
sarifLog.Save(OutputPath);
}
}
else
{
Expand Down

0 comments on commit cf5c3b8

Please sign in to comment.