diff options
author | crupest <crupest@outlook.com> | 2024-06-24 00:06:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-10-06 18:03:42 +0800 |
commit | b2a331aa527bdd5f4d91727904cc5c66fe897d62 (patch) | |
tree | e84d0bfdd4ed63255024e02954963d8c564ad024 /src/base/io/CFileStream.cpp | |
parent | dfe62dcf8bcefc523b466e127c3edc4dc2756629 (diff) | |
download | cru-b2a331aa527bdd5f4d91727904cc5c66fe897d62.tar.gz cru-b2a331aa527bdd5f4d91727904cc5c66fe897d62.tar.bz2 cru-b2a331aa527bdd5f4d91727904cc5c66fe897d62.zip |
Done Stream refactor.
NEED TEST: BufferStream, AutoReadStream, SubProcess.
Diffstat (limited to 'src/base/io/CFileStream.cpp')
-rw-r--r-- | src/base/io/CFileStream.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/base/io/CFileStream.cpp b/src/base/io/CFileStream.cpp index d5acc707..45eb2eaf 100644 --- a/src/base/io/CFileStream.cpp +++ b/src/base/io/CFileStream.cpp @@ -90,7 +90,9 @@ void CFileStream::DoFlush() { std::fflush(file_); } void CFileStream::DoClose() { CRU_STREAM_BEGIN_CLOSE - std::fclose(file_); + if (auto_close_ && !std::fclose(file_)) { + throw Exception(u"Failed to close FILE."); + } file_ = nullptr; } } // namespace cru::io |