Details
-
Wish
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Many command-line utilities use the "mainNoExit()" idiom to provide a testable entrypoint to the command-line utility that doesn't include calling System.exit. This allows tests to safely exercise the command-line utility end-to-end, without risk that the JVM will stop.
Often, command implementations themselves adhere to this idiom, and don't call Exit. However, this is compromised by the CommandLineUtils functions, which call Exit.exit when an error is encountered while parsing the command-line arguments.
These utilities are pervasively used in subclasses of CommandDefaultOptions, across hundreds of call-sites. We should figure out a way to replace this exit behavior with exceptions that are eventually propagated from the *Options constructors. This will allow the command-line implementations to handle these errors, and return the appropriate exit code from mainNoExit.
Attachments
Issue Links
- blocks
-
KAFKA-16420 Refactor utils.Exit call-sites to use thread-safe alternative
- Open
- is blocked by
-
KAFKA-14525 Move CLI tools from `core` to `tools` module
- Open