From 129bfa374a48cdf6c6629395fbfb15221bb6e89d Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Fri, 1 Mar 2002 10:35:03 +0000 Subject: [PATCH] Wrap block with finally to make sure System.exit is called and with correct exitCode git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271635 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/myrmidon/frontends/CLIMain.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java index d3ba2703f..021102d5a 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java @@ -112,8 +112,8 @@ public class CLIMain */ public static void main( final String[] args ) { + int exitCode = 0; final CLIMain main = new CLIMain(); - try { main.execute( args ); @@ -123,10 +123,12 @@ public class CLIMain final String message = REZ.getString( "error-message", ExceptionUtil.printStackTrace( throwable ) ); System.err.println( message ); - System.exit( -1 ); + exitCode = -1; + } + finally + { + System.exit( exitCode ); } - - System.exit( 0 ); } /**