Author: stevel Date: Tue Aug 22 16:04:54 2006 New Revision: 433793 URL: http://svn.apache.org/viewvc?rev=433793&view=rev Log: change error code of the launcher. We could change it from 2, its now in a constant where we can tune it.
Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=433793&r1=433792&r2=433793&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Tue Aug 22 16:04:54 2006 @@ -94,7 +94,7 @@ * <scp> now optionally supports the sftp protocol, you may need a newer jsch.jar. Bugzilla Report 39373. -* Ant launcher program prints errors to stderr, and exits with a -1 exit code +* Ant launcher program prints errors to stderr, and exits with a 2 exit code value if, for any reason, it cannot actually start Ant proper. This will only affect programs/scripts that called the launcher and which did not want to receive an error if ant itself would not start Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java?rev=433793&r1=433792&r2=433793&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java Tue Aug 22 16:04:54 2006 @@ -19,7 +19,6 @@ import java.net.URL; import java.net.URLClassLoader; import java.net.MalformedURLException; -import java.io.UnsupportedEncodingException; import java.io.File; import java.util.StringTokenizer; import java.util.List; @@ -90,6 +89,11 @@ private static final String JAVA_CLASS_PATH = "java.class.path"; /** + * Exit code on trouble + */ + protected static final int EXIT_CODE_ERROR = 2; + + /** * Entry point for starting command line Ant. * * @param args commandline arguments @@ -98,21 +102,20 @@ int exitCode; try { Launcher launcher = new Launcher(); - exitCode=launcher.run(args); + exitCode = launcher.run(args); } catch (LaunchException e) { - exitCode=-1; + exitCode = EXIT_CODE_ERROR; System.err.println(e.getMessage()); } catch (Throwable t) { - exitCode=-1; + exitCode = EXIT_CODE_ERROR; t.printStackTrace(System.err); } - if(exitCode!=0) { + if (exitCode != 0) { System.exit(exitCode); } } - - + /** * Add a CLASSPATH or -lib to lib path urls. * @@ -300,10 +303,10 @@ File mainJar = Locator.getClassSource(mainClass); System.err.println( "Location of this class " + mainJar); - exitCode=-1; + exitCode = EXIT_CODE_ERROR; } catch (Throwable t) { t.printStackTrace(System.err); - exitCode=-1; + exitCode = EXIT_CODE_ERROR; } return exitCode; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]