commit bb0a7465013642919c19cdfbcfc397ae5af048d3 parent b82cf60c03c7fe2e1ed4990431ab12e7c314d9fb Author: yao-msft <50888816+yao-msft@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:07:11 -0700 Explicitly close file stream on FileLogger destruction (#3424) Diffstat:
| M | src/AppInstallerCommonCore/FileLogger.cpp | | | 3 | +++ |
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/AppInstallerCommonCore/FileLogger.cpp b/src/AppInstallerCommonCore/FileLogger.cpp @@ -37,6 +37,9 @@ namespace AppInstaller::Logging FileLogger::~FileLogger() { m_stream.flush(); + // When std::ofstream is constructed from an existing File handle, it does not call fclose on destruction + // Only calling close() explicitly will close the file handle. + m_stream.close(); } std::string FileLogger::GetNameForPath(const std::filesystem::path& filePath)