Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-488

Change ToolBase.doMain() to return a status code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.6.0
    • 0.6.0
    • None
    • None

    Description

      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).

      Attachments

        1. patch.txt
          3 kB
          Andrzej Bialecki

        Activity

          People

            Unassigned Unassigned
            ab Andrzej Bialecki
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: