You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/08/26 00:28:10 UTC

svn commit: r436990 - in /incubator/stdcxx/trunk/util: exec.cpp runall.cpp

Author: sebor
Date: Fri Aug 25 15:28:09 2006
New Revision: 436990

URL: http://svn.apache.org/viewvc?rev=436990&view=rev
Log:
2006-08-25  Farid Zaripov  <fa...@kyiv.vdiweb.com>

	* exec.cpp [_WIN32 || _WIN64] (exec_file): Set appropriate error mode
	before running the child process to disable displaying the critical
	error-handler and general-protection-fault message boxes.
	* runall.cpp [_WIN32 || _WIN64]: Included windows.h and signal.h.
	(process_results): Handle returned status STATUS_ACCESS_VIOLATION
	and print status "SEGV".

Modified:
    incubator/stdcxx/trunk/util/exec.cpp
    incubator/stdcxx/trunk/util/runall.cpp

Modified: incubator/stdcxx/trunk/util/exec.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?rev=436990&r1=436989&r2=436990&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/exec.cpp (original)
+++ incubator/stdcxx/trunk/util/exec.cpp Fri Aug 25 15:28:09 2006
@@ -930,6 +930,11 @@
 
     merged = merge_argv (argv);
 
+    /* set appropriate error mode (the child process inherits this
+       error mode) to disable displaying the critical-error-handler
+       and general-protection-fault message boxes */
+    UINT old_mode = SetErrorMode (SEM_FAILCRITICALERRORS
+                                | SEM_NOGPFAULTERRORBOX);
     /* Create the child process */
     if (0 == CreateProcess (argv [0], merged, 0, 0, 1, 
         CREATE_NEW_PROCESS_GROUP, 0, 0, &context, &child)) {
@@ -937,6 +942,9 @@
         status.status = -1;
         status.error = warn_last_error ("Creating child process");;
     }
+
+    /* restore the previous error mode */
+    SetErrorMode (old_mode);
 
     /* Clean up handles */
     if (context.hStdInput)

Modified: incubator/stdcxx/trunk/util/runall.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/runall.cpp?rev=436990&r1=436989&r2=436990&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/runall.cpp (original)
+++ incubator/stdcxx/trunk/util/runall.cpp Fri Aug 25 15:28:09 2006
@@ -35,6 +35,8 @@
 #include <sys/stat.h>
 #if !defined (_WIN32) && !defined (_WIN64)
 #  include <sys/wait.h>   /* for WIFEXITED(), ... */
+#else
+#  include <windows.h>    /* for STATUS_ACCESS_VIOLATION */
 #endif
 
 #include "cmdopt.h"
@@ -353,6 +355,8 @@
         puts ("   I/O");
     else if (result->error)
         puts ("KILLED");
+    else if (STATUS_ACCESS_VIOLATION == result->status)
+        puts ("  SEGV");
     else
         printf ("%6d\n", result->status);
 #endif   /* _WIN{32,64} */