[ 
https://issues.apache.org/jira/browse/HADOOP-6143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12729937#action_12729937
 ] 

Todd Lipcon commented on HADOOP-6143:
-------------------------------------

{code}
t...@todd-laptop:/tmp$ cat Test.java 
public class Test {
  public static void main(String []args) {
    System.exit(-1);
  }
}
t...@todd-laptop:/tmp$ javac Test.java 
t...@todd-laptop:/tmp$ java -cp . Test ; echo $?
255
{code}

It's possible this might actually return -1 on some other OS though (does 
Windows have a concept of an exit code? I think maybe?). Changing the docs to 
say "nonzero" vs "zero" instead of -1 vs 0 does make sense, though.

> FS shell commands returns incorrect exit code  when error occurs
> ----------------------------------------------------------------
>
>                 Key: HADOOP-6143
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6143
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: Ravi Phulari
>            Assignee: Todd Lipcon
>
> HDFS documentation ( 
> http://hadoop.apache.org/core/docs/current/hdfs_shell.html#du )  mentions 
> that 
> {noformat}
> Exit Code:
> Returns 0 on success and -1 on error. 
> {noformat} 
> Current Fs shell behavior is buggy with this agreement.
> {code}
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -ls foo
> ls: Cannot access foo: No such file or directory.
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -lsr foo
> lsr: Cannot access foo: No such file or directory.
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -du foo
> du: Cannot access foo: No such file or directory.
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -dus foo
> dus: Cannot access foo: No such file or directory.
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -cp foo f2
> cp: File does not exist: foo
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -copyToLocal foo f2
> copyToLocal: null
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> statepick-lm:Hadoop rphulari$ bin/hadoop fs -copyFromLocal foo f2
> copyFromLocal: File foo does not exist.
> statepick-lm:Hadoop rphulari$ echo $?
> 255
> {code}  
> In all above cases exit code on error should be -1 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to