[ http://issues.apache.org/jira/browse/HADOOP-488?page=comments#action_12431898 ] Owen O'Malley commented on HADOOP-488: --------------------------------------
This patch is ok since the System.exit is being called from the main instead of ToolBase. It certainly is important that dfs shell and dist cp return exit codes when they fail. I'd even be ok with having the System.exit be in ToolBase, if it was only called on failure. Basically, the end of doMain would have: if (result != 0) { System.exit(result); } > 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