public boolean hasExited() {
            return hasExited;
        }
Capture both the console output and console error during the execution of the provided function.
tools/src/test/java/org/apache/kafka/tools/ToolsTestUtils.java