Skip to content

Commit bb0a746

Browse files
authored
Explicitly close file stream on FileLogger destruction (microsoft#3424)
1 parent b82cf60 commit bb0a746

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/AppInstallerCommonCore/FileLogger.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ namespace AppInstaller::Logging
3737
FileLogger::~FileLogger()
3838
{
3939
m_stream.flush();
40+
// When std::ofstream is constructed from an existing File handle, it does not call fclose on destruction
41+
// Only calling close() explicitly will close the file handle.
42+
m_stream.close();
4043
}
4144

4245
std::string FileLogger::GetNameForPath(const std::filesystem::path& filePath)

0 commit comments

Comments
 (0)