diff --git a/test/main.cpp b/test/main.cpp index bbb81b10a..f89226c21 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -45,6 +45,10 @@ int test_main(); #include "libtorrent/file.hpp" #include +#ifdef WIN32 +#include // fot SetErrorMode +#endif + void sig_handler(int sig) { char stack_text[10000]; @@ -80,6 +84,13 @@ using namespace libtorrent; 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())); #ifdef O_NONBLOCK // on darwin, stdout is set to non-blocking mode by default