>>>>> "sr" == rubys <[EMAIL PROTECTED]> writes:
sr> For starters, cmd doesn't work on 95/98 (so that's a bug).
sr> Worse yet, if you do multiple commands Windows NT/2000 will open
sr> up a new window and you can't capture the output.
Thank you, Sam. So the test is there to avoid the "cmd /c" construct
whenever it seems unnecessary? I understand.
Apart from finding "the correct solution" for Windows - which I
obviously cannot provide - something like the appended patch seems the
only choice to get <exec> and friends working properly in subprojects
on NT, right?
Stefan
Index: src/main/org/apache/tools/ant/Project.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.20
diff -u -r1.20 Project.java
--- src/main/org/apache/tools/ant/Project.java 2000/05/27 22:21:09 1.20
+++ src/main/org/apache/tools/ant/Project.java 2000/06/13 11:59:06
@@ -95,6 +95,7 @@
private String name;
private PrintStream out;
private int msgOutputLevel = MSG_INFO;
+ private boolean topLevel = true;
private Hashtable properties = new Hashtable();
private Hashtable userProperties = new Hashtable();
@@ -276,6 +277,14 @@
public static String getJavaVersion() {
return javaVersion;
+ }
+
+ public void setTopLevel(boolean topLevel) {
+ this.topLevel = topLevel;
+ }
+
+ public boolean isTopLevel() {
+ return topLevel;
}
private void detectJavaVersion() {
Index: src/main/org/apache/tools/ant/taskdefs/Ant.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.6
diff -u -r1.6 Ant.java
--- src/main/org/apache/tools/ant/taskdefs/Ant.java 2000/03/28 20:40:18 1.6
+++ src/main/org/apache/tools/ant/taskdefs/Ant.java 2000/06/13 11:59:07
@@ -135,6 +135,8 @@
target = p1.getDefaultTarget();
}
+ p1.setTopLevel(false);
+
p1.executeTarget(target);
}
Index: src/main/org/apache/tools/ant/taskdefs/Exec.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
retrieving revision 1.9
diff -u -r1.9 Exec.java
--- src/main/org/apache/tools/ant/taskdefs/Exec.java 2000/04/01 14:25:07 1.9
+++ src/main/org/apache/tools/ant/taskdefs/Exec.java 2000/06/13 11:59:07
@@ -93,7 +93,7 @@
if (dir == null) dir = project.getBaseDir();
if (myos.toLowerCase().indexOf("windows") >= 0) {
- if (!dir.equals(project.resolveFile(".")))
+ if (!dir.equals(project.resolveFile(".")) || !project.isTopLevel())
command = "cmd /c cd " + dir + " && " + command;
} else {
String ant = project.getProperty("ant.home");