[ 
https://issues.apache.org/jira/browse/HDFS-11516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15907425#comment-15907425
 ] 

Kai Sasaki commented on HDFS-11516:
-----------------------------------

[~andrew.wang] Thank you for comments.

{code}
if we're printing to stderr and it's a fatal error, shouldn't it also return a 
non-zero return code?
{code}
Ideally it should return a non-zero code I think. As described the document you 
introduced, error such as invalid argument should be printed into stderr and 
other CLI like {{CryptCLI}} returns non-zero code.

{code}
    public int run(Configuration conf, List<String> args) throws IOException {
      final String path = StringUtils.popOptionWithArgument("-path", args);

      if (!args.isEmpty()) {
        System.err.println("Can't understand argument: " + args.get(0));
        return 1;
      }
  }
{code}

But in terms of return code it can affect client side, I think it might be 
necessary to take care.

{code}
it would be nice to test the error codes though.
{code}
I'll update to add test code to check error code.

> Admin command line should print message to stderr in failure case
> -----------------------------------------------------------------
>
>                 Key: HDFS-11516
>                 URL: https://issues.apache.org/jira/browse/HDFS-11516
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Kai Sasaki
>            Assignee: Kai Sasaki
>            Priority: Minor
>         Attachments: HDFS-11516.01.patch
>
>
> {{AdminHelper}} and {{CryptAdmin}} where prints message to stdout instead of 
> stderr. Since other failure cases prints to stderr, it is necessary to 
> consolidate that manner.
> e.g.
> {code}
>       if (args.size() != 1) {
>         System.err.println("You must give exactly one argument to -help.");
>         return 0;
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to