From 75c231e6c863265ca7013d55344b35e9122bb3bb Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Sat, 16 Sep 2006 21:45:14 +0000 Subject: [PATCH] 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 --- CONTRIBUTORS | 1 + contributors.xml | 4 ++++ src/main/org/apache/tools/ant/types/Commandline.java | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ccfd94629..f11e4257c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -63,6 +63,7 @@ Don Brown Don Ferguson Don Jeffery Drew Sudell +Edwin Woudt Eli Tucker Emmanuel Bourg Eric Olsen diff --git a/contributors.xml b/contributors.xml index f5333cbc7..14455ab18 100644 --- a/contributors.xml +++ b/contributors.xml @@ -263,6 +263,10 @@ Drew Sudell + + Edwin + Woudt + Eli Tucker diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java index 9105dd211..de79b7710 100644 --- a/src/main/org/apache/tools/ant/types/Commandline.java +++ b/src/main/org/apache/tools/ant/types/Commandline.java @@ -30,6 +30,7 @@ import java.util.Iterator; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.util.StringUtils; +import org.apache.tools.ant.taskdefs.condition.Os; /** * 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 { + /** 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 @@ -347,7 +350,10 @@ public class Commandline implements Cloneable { } else { 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 + '\"'; } else { return argument;