[ http://issues.apache.org/jira/browse/HADOOP-488?page=comments#action_12431901 ] Andrzej Bialecki commented on HADOOP-488: ------------------------------------------
That wouldn't do - some tools may call several doMain()-s in sequence, and check their return codes, and act appropriately without exiting the JVM. IMHO it's better to leave it as it is in the current patch, and handle System.exit in each tool's main method. > Change ToolBase.doMain() to return a status code > ------------------------------------------------ > > Key: HADOOP-488 > URL: http://issues.apache.org/jira/browse/HADOOP-488 > Project: Hadoop > Issue Type: Improvement > Affects Versions: 0.6.0 > Reporter: Andrzej Bialecki > Fix For: 0.6.0 > > Attachments: patch.txt > > > I propose to change the signature of ToolBase.doMain from this: > public final void doMain(Configuration conf, String[] args) throws > Exception; > to this: > public final int doMain(Configuration conf, String[] args) throws > Exception; > and then change main() methods of all classes that use ToolBase.doMain to > call System.exit(code), where "code" is this return value from doMain(). All > command-line tools, which still call main() methods of other tools, should be > converted to use doMain() and return exit codes properly. > The main reason for this change is that returning varying exit codes is > required for proper operation of shell scripts, especially differing between > code == 0 (normal exit) and code != 0 (error exit). > Additionally, current implementation of doMain() already gets the return > code, it just silently discards it (ToolBase.java:184). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira