Skip to content

Exit code control from built-in handlers #251

@remkop

Description

@remkop

Commonly, successful execution of a command should result in a zero exit code and unsuccessful invocation should result in a non-zero exit code.

The java executable does not return a non-zero exit code if the application exits because of an uncaught throwable. It’s up to the application to call System.exit(int) if control over the exit code is desired.

Picocli has a “success” path and three separate “failure” paths:

  • InitializationException if misconfigured
  • ParameterException if user input is invalid
  • ExecutionException if user input was valid but the IParseResultHandler threw an exception
  • No errors

Consider providing API to let applications control the exit code for all of the above.

See also discussion under #218 for API ideas on how to accomplish this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions