aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-08-21 17:05:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-08-21 17:05:41 +0300
commitc8022d1e701a4663840003f165f5a804d837524e (patch)
treec3c27bd97223b5969739ff46e8cc416025ea18b1
parentaa20084bc35eb2248279d05b22338291c2bb2f4e (diff)
Disable displaying error reporting dialog box on Windows unless run serially
-rw-r--r--build2/b.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index ef8b97b..1510b39 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -4,6 +4,8 @@
#ifndef _WIN32
# include <signal.h> // signal()
+#else
+# include <libbutl/win32-utility.hxx>
#endif
#include <stdlib.h> // getenv() _putenv()(_WIN32)
@@ -102,10 +104,18 @@ main (int argc, char* argv[])
// terminates a process. Also note that there is no way to disable this
// behavior on a file descriptor basis or for the write() function call.
//
+ // On Windows disable displaying error reporting dialog box for the current
+ // and child processes unless we run serially. This way we avoid multiple
+ // dialog boxes to potentially pop up.
+ //
#ifndef _WIN32
if (signal (SIGPIPE, SIG_IGN) == SIG_ERR)
fail << "unable to ignore broken pipe (SIGPIPE) signal: "
<< system_error (errno, generic_category ()); // Sanitize.
+#else
+ if (!ops.serial_stop ())
+ SetErrorMode (SetErrorMode (0) | // Returns the current mode.
+ SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
#endif
// Parse the command line. We want to be able to specify options, vars,