Browse Source

bugzilla 16604: escape ; for external commands in win9x

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@446960 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
75c231e6c8
3 changed files with 12 additions and 1 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      contributors.xml
  3. +7
    -1
      src/main/org/apache/tools/ant/types/Commandline.java

+ 1
- 0
CONTRIBUTORS View File

@@ -63,6 +63,7 @@ Don Brown
Don Ferguson Don Ferguson
Don Jeffery Don Jeffery
Drew Sudell Drew Sudell
Edwin Woudt
Eli Tucker Eli Tucker
Emmanuel Bourg Emmanuel Bourg
Eric Olsen Eric Olsen


+ 4
- 0
contributors.xml View File

@@ -263,6 +263,10 @@
<first>Drew</first> <first>Drew</first>
<last>Sudell</last> <last>Sudell</last>
</name> </name>
<name>
<first>Edwin</first>
<last>Woudt</last>
</name>
<name> <name>
<first>Eli</first> <first>Eli</first>
<last>Tucker</last> <last>Tucker</last>


+ 7
- 1
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -30,6 +30,7 @@ import java.util.Iterator;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.StringUtils;
import org.apache.tools.ant.taskdefs.condition.Os;


/** /**
* Commandline objects help handling command lines specifying processes to * Commandline objects help handling command lines specifying processes to
@@ -52,6 +53,8 @@ import org.apache.tools.ant.util.StringUtils;
* *
*/ */
public class Commandline implements Cloneable { public class Commandline implements Cloneable {
/** win9x uses a (shudder) bat file (antRun.bat) for executing commands */
private static boolean IS_WIN_9X = Os.isFamily("win9x");


/** /**
* The arguments of the command * The arguments of the command
@@ -347,7 +350,10 @@ public class Commandline implements Cloneable {
} else { } else {
return '\'' + argument + '\''; return '\'' + argument + '\'';
} }
} else if (argument.indexOf("\'") > -1 || argument.indexOf(" ") > -1) {
} else if (argument.indexOf("\'") > -1
|| argument.indexOf(" ") > -1
// WIN9x uses a bat file for executing commands
|| (IS_WIN_9X && argument.indexOf(';') != -1)) {
return '\"' + argument + '\"'; return '\"' + argument + '\"';
} else { } else {
return argument; return argument;


Loading…
Cancel
Save