mention compatibility implications of wxExecute() quoting changes; don't change quoting of already quoted arguments in 2.8 for compatibility; also fix handling of empty arguments as a side effect (see #4115)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -99,6 +99,8 @@ Changes in behaviour not resulting in compilation errors, please read this!
|
|||||||
your code if you overrode these functions and change the functions in the
|
your code if you overrode these functions and change the functions in the
|
||||||
derived classes to use const reference as well.
|
derived classes to use const reference as well.
|
||||||
|
|
||||||
|
- Under MSW wxExecute() arguments are now always properly quoted, as under
|
||||||
|
Unix, and so shouldn't contain quotes unless they are part of the argument.
|
||||||
|
|
||||||
Changes in behaviour which may result in compilation errors
|
Changes in behaviour which may result in compilation errors
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
@@ -1032,16 +1032,28 @@ long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler)
|
|||||||
{
|
{
|
||||||
arg = *argv++;
|
arg = *argv++;
|
||||||
|
|
||||||
// escape any quotes present in the string to avoid interfering with
|
bool quote;
|
||||||
// the command line parsing in the child process
|
if ( arg.empty() )
|
||||||
arg.Replace("\"", "\\\"", true /* replace all */);
|
{
|
||||||
|
// we need to quote empty arguments, otherwise they'd just
|
||||||
|
// disappear
|
||||||
|
quote = true;
|
||||||
|
}
|
||||||
|
else // non-empty
|
||||||
|
{
|
||||||
|
// 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
|
// and quote any arguments containing the spaces to prevent them from
|
||||||
// being broken down
|
// being broken down
|
||||||
if ( arg.find_first_of(" \t") == wxString::npos )
|
quote = arg.find_first_of(" \t") != wxString::npos;
|
||||||
command += arg;
|
}
|
||||||
else
|
|
||||||
|
if ( quote )
|
||||||
command += '\"' + arg + '\"';
|
command += '\"' + arg + '\"';
|
||||||
|
else
|
||||||
|
command += arg;
|
||||||
|
|
||||||
if ( !*argv )
|
if ( !*argv )
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user