X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/386a2898e3a55362d30d22adf024b95ce0d5773f..f369c7c2841c0534424f2c184783c1a2070012cf:/src/msw/utilsexc.cpp diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 60fb2164e5..7c085553ed 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -1027,9 +1027,22 @@ long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler) wxString command; command.reserve(1024); + 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("\"", "\\\"", true /* replace all */); + + // and quote any arguments containing the spaces to prevent them from + // being broken down + if ( arg.find_first_of(" \t") == wxString::npos ) + command += arg; + else + command += '\"' + arg + '\"'; + if ( !*argv ) break;