quote the arguments containing spaces or quotes correctly in wxExecute(char **) overload (#4115)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-07-01 00:05:36 +00:00
parent c3e7fde30f
commit b69b11c40c
2 changed files with 15 additions and 1 deletions

View File

@@ -114,6 +114,7 @@ wxMSW:
- Fix keyboard support in wxSpinCtrl broken in 2.8.8.
- Compile fix for WinCE in window.cpp (no VkKeyScan in Windows CE).
- Fix quoting of arguments passed to wxExecute(char **) (briis).
wxGTK:

View File

@@ -952,9 +952,22 @@ long wxExecute(wxChar **argv, int flags, wxProcess *handler)
{
wxString command;
wxString arg;
for ( ;; )
{
command += *argv++;
arg = *argv++;
// escape any quotes present in the string to avoid interfering with
// the command line parsing in the child process
arg.Replace(_T("\""), _T("\\\""), true /* replace all */);
// and quote any arguments containing the spaces to prevent them from
// being broken down
if ( arg.find_first_of(_T(" \t")) == wxString::npos )
command += arg;
else
command += _T('\"') + arg + _T('\"');
if ( !*argv )
break;