You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/08/03 12:29:24 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java Execute.java
bodewig 00/08/03 03:29:22
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs Exec.java
Execute.java
Log:
Mac patches to Execute (regarding working directory).
Submitted by: beard@netscape.com (Patrick Beard)
Revision Changes Path
1.9 +8 -2 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WHATSNEW 2000/08/01 09:18:38 1.8
+++ WHATSNEW 2000/08/03 10:29:17 1.9
@@ -19,9 +19,11 @@
Other changes:
--------------
-* New tasks: sql, junit, mparse, execon. All except sql pending
-documentation, most of them pending review.
+* New tasks: sql, genkey, cab.
+* New tasks junit, mparse, execon. All pending documentation, most of
+them pending review.
+
* <java> uses ClassLoader of its own in no-fork mode if a classpath is
specified.
@@ -55,3 +57,7 @@
* Project didn't interpret the basedir attribute correctly in all
cases.
+
+* Nested <src> in <javac> caused NullPointerException.
+
+* Corrupt Zip- and Jar-files ar now deleted if the task fails.
\ No newline at end of file
1.16 +3 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
Index: Exec.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Exec.java 2000/07/15 06:31:42 1.15
+++ Exec.java 2000/08/03 10:29:20 1.16
@@ -62,6 +62,9 @@
*
* @author duncan@x180.com
* @author rubys@us.ibm.com
+ *
+ * @deprected Instead of using this class, please extend ExecTask or
+ * delegate to Execute.
*/
public class Exec extends Task {
private String os;
1.5 +18 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Execute.java 2000/08/01 12:47:55 1.4
+++ Execute.java 2000/08/03 10:29:20 1.5
@@ -127,7 +127,8 @@
String[] commandLine = cmdl;
if (workingDirectory != null &&
- !antWorkingDirectory.equals(workingDirectory.getAbsolutePath())) {
+ !antWorkingDirectory.equals(workingDirectory.getAbsolutePath()) &&
+ !myos.equals("Mac OS")) {
if (myos.toLowerCase().indexOf("windows") >= 0 &&
(myos.toLowerCase().indexOf("nt") >= 0 ||
@@ -200,6 +201,9 @@
* @param project the current project.
*/
public void setAntRun(Project project) throws BuildException {
+ if (myos.equals("Mac OS"))
+ return;
+
String ant = project.getProperty("ant.home");
if (ant == null) {
throw new BuildException("Property 'ant.home' not found");
@@ -240,7 +244,19 @@
protected Process exec() throws IOException {
- return Runtime.getRuntime().exec(getCommandline(), getEnvironment());
+ String userDir = System.getProperty("user.dir");
+ try {
+ if (myos.equals("Mac OS") && workingDirectory != null) {
+ System.getProperties().put("user.dir",
+ workingDirectory.getAbsolutePath());
+ }
+
+ return Runtime.getRuntime().exec(getCommandline(), getEnvironment());
+ } finally {
+ if (myos.equals("Mac OS") && workingDirectory != null) {
+ System.getProperties().put("user.dir", userDir);
+ }
+ }
}
protected void waitFor(Process process) {