mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Don't clobber game log file when we collect a stack trace.
When the crash catcher catch a signal it forks to collect data about its parent. In the process the child reinitialize the log file, which ends up empty.
This commit is contained in:
parent
0b8cae4af8
commit
4058e117ca
3 changed files with 9 additions and 2 deletions
|
@ -179,7 +179,12 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c
|
|||
std::cerr.rdbuf (&sb);
|
||||
#else
|
||||
// Redirect cout and cerr to the log file
|
||||
logfile.open (boost::filesystem::path(cfgMgr.getLogPath() / logName));
|
||||
// If we are collecting a stack trace, append to existing log file
|
||||
std::ios_base::openmode mode = std::ios::out;
|
||||
if(argc == 2 && strcmp(argv[1], crash_switch) == 0)
|
||||
mode |= std::ios::app;
|
||||
|
||||
logfile.open (boost::filesystem::path(cfgMgr.getLogPath() / logName), mode);
|
||||
|
||||
coutsb.open (Debug::Tee(logfile, oldcout));
|
||||
cerrsb.open (Debug::Tee(logfile, oldcerr));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue