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:
@@ -114,6 +114,7 @@ wxMSW:
|
|||||||
|
|
||||||
- Fix keyboard support in wxSpinCtrl broken in 2.8.8.
|
- Fix keyboard support in wxSpinCtrl broken in 2.8.8.
|
||||||
- Compile fix for WinCE in window.cpp (no VkKeyScan in Windows CE).
|
- Compile fix for WinCE in window.cpp (no VkKeyScan in Windows CE).
|
||||||
|
- Fix quoting of arguments passed to wxExecute(char **) (briis).
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -952,9 +952,22 @@ long wxExecute(wxChar **argv, int flags, wxProcess *handler)
|
|||||||
{
|
{
|
||||||
wxString command;
|
wxString command;
|
||||||
|
|
||||||
|
wxString arg;
|
||||||
for ( ;; )
|
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 )
|
if ( !*argv )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user