On Thu, 22 May 2025 01:46:40 GMT, Lance Andersen <lan...@openjdk.org> wrote:

>> I use exit code, but still keep non-zero instead of > 0. Leave that to 
>> future work if we want to have more specific value for exit code for 
>> different situations.
>
> Non-zero could also mean negative which we currently do not do nor do,I see 
> that going forward as part of future additions to validate

We are somewhat inconsistent in documenting the exit code from our commands as 
many do not include any mention

A few for reference

**java command**:

> The following exit values are typically returned by the launcher when the 
> launcher is called with the wrong arguments, serious errors, or exceptions 
> thrown by the JVM. However, a Java application may choose to return any value 
> by using the API call System.exit(exitValue). The values are:

    0: Successful completion

    >0: An error occurred

**jarsigner command**:

>  If there is a failure, the jarsigner command exits with code 1. If there is 
> no failure, but there are one or more severe warnings, the jarsigner command 
> exits with code 0 when the -strict option is not specified, or exits with the 
> OR-value of the warning codes when the -strict is specified. If there is only 
> informational warnings or no warning at all, the command always exits with 
> code 0.

See 
https://docs.oracle.com/en/java/javase/24/docs/specs/man/jarsigner.html#errors-and-warnings
 for the full details

**jshell command**:

> /exit [integer-expression-snippet]
>     Exits the tool. If no snippet is entered, the exit status is zero. If a 
> snippet is entered and the result of the snippet is an integer, the result is 
> used as the exit status. If an error occurs, or the result of the snippet is 
> not an integer, an error is displayed and the tool remains active. 

`% jshell
|  Welcome to JShell -- Version 22.0.1
|  For an introduction type: /help intro

jshell> System.out.print("hi");
hi
jshell> /exit 1
|  Goodbye (1)
 % echo $?
1
`
So,  currently, the jdk commands use either:

- exit code
- exit value
- exit status
- exit with code

I would probably go with either "exit status" or "exit value"

And as I mentioned in a prior comment we should move away from non-zero and use 
either '>0' as java and several unix based commands do or use "greater than 0"

**Note:**
Other several commands such as jdeperscan do not specify the exit status value 
and I think we need to document the possible exit status values for the jdk 
commands and perhaps target this for jdk 26

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2102431539

Reply via email to