@Override
        public void execute(int statusCode, String message) {
            if (!this.hasExited) {
                this.hasExited = true;
                this.statusCode = statusCode;
            }
        }
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