From: Vadim Zeitlin Date: Mon, 19 Dec 2011 12:54:48 +0000 (+0000) Subject: Added support for wxEXEC_MAKE_GROUP_LEADER to wxExecute(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ee4d43806461a4856ed526db164f1a6207027f81 Added support for wxEXEC_MAKE_GROUP_LEADER to wxExecute(). 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 --- diff --git a/docs/changes.txt b/docs/changes.txt index b13873e7b6..7b96a2c650 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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) ------ diff --git a/include/wx/utils.h b/include/wx/utils.h index 8c951845f1..1ee4f2fbcb 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -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 diff --git a/interface/wx/utils.h b/interface/wx/utils.h index ba0c34aaf9..3dfa72f319 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -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 diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 4dca1464f3..3fdf3b9aad 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -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