log/windows: Close stdout and stderr on destruction if redirected
No real reason to do this since these resources should be automatically released on process exit anyway, but, better safe than sorry I guess.
This commit is contained in:
parent
900dc5b070
commit
bc9fb0c111
1 changed files with 13 additions and 0 deletions
|
@ -208,6 +208,7 @@ class log_file_manager : private boost::noncopyable
|
|||
{
|
||||
public:
|
||||
log_file_manager();
|
||||
~log_file_manager();
|
||||
|
||||
/**
|
||||
* Returns the path to the current log file.
|
||||
|
@ -285,6 +286,18 @@ log_file_manager::log_file_manager()
|
|||
LOG_LS << "Opened log file at " << new_path << '\n';
|
||||
}
|
||||
|
||||
log_file_manager::~log_file_manager()
|
||||
{
|
||||
if(cur_path_.empty()) {
|
||||
// No log file, nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
DBG_LS << "Closing log file...\n";
|
||||
fclose(stdout);
|
||||
fclose(stderr);
|
||||
}
|
||||
|
||||
std::string log_file_manager::log_file_path() const
|
||||
{
|
||||
return cur_path_;
|
||||
|
|
Loading…
Add table
Reference in a new issue