You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2005/03/11 12:22:20 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Exec.java
peterreilly 2005/03/11 03:22:20
Modified: src/main/org/apache/tools/ant/taskdefs Exec.java
Log:
javadoc + make a variable final
Revision Changes Path
1.41 +46 -2 ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
Index: Exec.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Exec.java 9 Mar 2004 16:48:04 -0000 1.40
+++ Exec.java 11 Mar 2005 11:22:20 -0000 1.41
@@ -1,5 +1,5 @@
/*
- * Copyright 2000,2002,2004 The Apache Software Foundation
+ * Copyright 2000,2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,10 @@
protected PrintWriter fos = null;
private boolean failOnError = false;
+ /**
+ * Constructor for Exec.
+ * Prints a warning message to std error.
+ */
public Exec() {
System.err.println("As of Ant 1.2 released in October 2000, "
+ "the Exec class");
@@ -55,10 +59,20 @@
System.err.println("Don\'t use it!");
}
+ /**
+ * Execute the task.
+ * @throws BuildException on error
+ */
public void execute() throws BuildException {
run(command);
}
+ /**
+ * Execute the command.
+ * @param command the command to exec
+ * @return the exit value of the command
+ * @throws BuildException on error
+ */
protected int run(String command) throws BuildException {
int err = -1; // assume the worst
@@ -152,26 +166,53 @@
return err;
}
+ /**
+ * Set the directory.
+ * @param d a <code>String</code> value
+ */
public void setDir(String d) {
this.dir = getProject().resolveFile(d);
}
+ /**
+ * Set the Operating System that this exec is to run in.
+ * @param os a <code>String</code> value
+ */
public void setOs(String os) {
this.os = os;
}
+ /**
+ * Set the command to exec.
+ * @param command a <code>String</code> value
+ */
public void setCommand(String command) {
this.command = command;
}
+ /**
+ * Set the output filename.
+ * @param out a <code>String</code> value
+ */
public void setOutput(String out) {
this.out = out;
}
+ /**
+ * Set the failOnError attribute.
+ * Default is false.
+ * @param fail a <code>boolean</code> value
+ */
public void setFailonerror(boolean fail) {
failOnError = fail;
}
+ /**
+ * Log an output message.
+ * @param line the line to putput
+ * @param messageLevel the level of logging - ignored
+ * if output is going to a file
+ */
protected void outputLog(String line, int messageLevel) {
if (fos == null) {
log(line, messageLevel);
@@ -180,6 +221,9 @@
}
}
+ /**
+ * Close output.
+ */
protected void logFlush() {
if (fos != null) {
fos.close();
@@ -192,7 +236,7 @@
private BufferedReader din;
private int messageLevel;
private boolean endOfStream = false;
- private int SLEEP_TIME = 5;
+ private static final int SLEEP_TIME = 5;
public StreamPumper(InputStream is, int messageLevel) {
this.din = new BufferedReader(new InputStreamReader(is));
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org