Be sure to open the hitfile with read access. (#1214)
Be sure to open the hitfile with read access.
This commit is contained in:
committed by
GitHub
parent
468b6326b8
commit
8f91b3414f
@@ -408,7 +408,7 @@ namespace Coverlet.Core
|
||||
}
|
||||
|
||||
var documentsList = result.Documents.Values.ToList();
|
||||
using (var fs = _fileSystem.NewFileStream(result.HitsFilePath, FileMode.Open))
|
||||
using (var fs = _fileSystem.NewFileStream(result.HitsFilePath, FileMode.Open, FileAccess.Read))
|
||||
using (var br = new BinaryReader(fs))
|
||||
{
|
||||
int hitCandidatesCount = br.ReadInt32();
|
||||
@@ -442,8 +442,15 @@ namespace Coverlet.Core
|
||||
}
|
||||
}
|
||||
|
||||
_instrumentationHelper.DeleteHitsFile(result.HitsFilePath);
|
||||
_logger.LogVerbose($"Hit file '{result.HitsFilePath}' deleted");
|
||||
try
|
||||
{
|
||||
_instrumentationHelper.DeleteHitsFile(result.HitsFilePath);
|
||||
_logger.LogVerbose($"Hit file '{result.HitsFilePath}' deleted");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning($"Unable to remove hit file: {result.HitsFilePath} because : {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user