SetErrorMode at the start of unit tests (on windows)

This commit is contained in:
Arvid Norberg 2013-08-04 03:04:59 +00:00
parent a854373a04
commit 436bb199e3
1 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,10 @@ int test_main();
#include "libtorrent/file.hpp" #include "libtorrent/file.hpp"
#include <signal.h> #include <signal.h>
#ifdef WIN32
#include <windows.h> // fot SetErrorMode
#endif
void sig_handler(int sig) void sig_handler(int sig)
{ {
char stack_text[10000]; char stack_text[10000];
@ -80,6 +84,13 @@ using namespace libtorrent;
int main() int main()
{ {
#ifdef WIN32
// try to suppress hanging the process by windows displaying
// modal dialogs.
SetErrorMode(SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOALIGNMENTFAULTEXCEPT
| SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
#endif
srand(total_microseconds(time_now_hires() - min_time())); srand(total_microseconds(time_now_hires() - min_time()));
#ifdef O_NONBLOCK #ifdef O_NONBLOCK
// on darwin, stdout is set to non-blocking mode by default // on darwin, stdout is set to non-blocking mode by default