]> git.saurik.com Git - wxWidgets.git/commitdiff
Added support for wxEXEC_MAKE_GROUP_LEADER to wxExecute().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Dec 2011 12:54:48 +0000 (12:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Dec 2011 12:54:48 +0000 (12:54 +0000)
Map it to the native CREATE_NEW_PROCESS_GROUP flag as it's broadly similar to
Unix semantics.

Closes #13676.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/utils.h
interface/wx/utils.h
src/msw/utilsexc.cpp

index b13873e7b6fce2f9208b08bed48375111cbeec9b..7b96a2c6504c4619bd26dd04e622e9a8443a9745 100644 (file)
@@ -454,6 +454,10 @@ All (GUI):
 - Added wxDataViewItemAttr::SetBackgroundColour() and implemented it in generic
   wxDataViewCtrl (Andrew Xu).
 
+MSW:
+
+- Added support for wxEXEC_MAKE_GROUP_LEADER to wxExecute (tteras).
+
 
 2.9.3: (released 2011-12-14)
 ------
index 8c951845f1aa89a1b3339b9d9313a9a104a37eb2..1ee4f2fbcbf8a227938f123c6328406a181e8800 100644 (file)
@@ -342,6 +342,9 @@ enum
 
     // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill
     // kills all children as well as pid
+    // under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag,
+    // which allows to target Ctrl-Break signal to the spawned process.
+    // applies to console processes only.
     wxEXEC_MAKE_GROUP_LEADER = 4,
 
     // by default synchronous execution disables all program windows to avoid
index ba0c34aaf926b3cd0b3e1cbfd774625491e2bb39..3dfa72f319515d719d2c35fc22a4c00a94d2c7b9 100644 (file)
@@ -849,7 +849,12 @@ enum
         Under Unix, if the process is the group leader then passing
         wxKILL_CHILDREN to wxKill() kills all children as well as pid.
 
-        This flag is currently ignored under MSW.
+        Under MSW, applies only to console applications and is only supported
+        under NT family (i.e. not under Windows 9x). It corresponds to the
+        native @c CREATE_NEW_PROCESS_GROUP and, in particular, ensures that
+        Ctrl-Break signals will be sent to all children of this process as well
+        to the process itself. Support for this flag under MSW was added in
+        version 2.9.4 of wxWidgets.
      */
     wxEXEC_MAKE_GROUP_LEADER = 4,
 
@@ -935,7 +940,8 @@ enum
     the new process is a group leader (this will create a new session if
     needed). Calling wxKill() passing wxKILL_CHILDREN will kill this process as
     well as all of its children (except those which have started their own
-    session).
+    session). Under MSW, this flag can be used with console processes only and
+    corresponds to the native @c CREATE_NEW_PROCESS_GROUP flag.
 
     The @c wxEXEC_NOEVENTS flag prevents processing of any events from taking
     place while the child process is running. It should be only used for very
index 4dca1464f3719648d8cfb04498a0d199c8e3def3..3fdf3b9aad5f0a0fdd35b97107d48a06f97d87a6 100644 (file)
@@ -794,6 +794,10 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
     DWORD dwFlags = CREATE_SUSPENDED;
 
 #ifndef __WXWINCE__
+    if ( (flags & wxEXEC_MAKE_GROUP_LEADER) &&
+            (wxGetOsVersion() == wxOS_WINDOWS_NT) )
+        dwFlags |= CREATE_NEW_PROCESS_GROUP;
+
     dwFlags |= CREATE_DEFAULT_ERROR_MODE ;
 #else
     // we are assuming commands without spaces for now