When running in non-interactive mode, output sent to CommandContext.outputWriter() is not displayed. This is due to NonInteractiveShellRunner explicitly configuring the outputWriter to discard the output. Why would you not want to see command output in non-interactive mode?
Steps to reproduce
Run the spring-shell-sample-non-interactive sample and pass one of the built-in commands like help or version. The expected output from the built-in command is not displayed.
Or, change the spring-shell-sample-non-interactive sample command from:
@Command
public void hi() {
System.out.println("Hello world!");
}
to
@Command
public void hi(CommandContext commandContext) {
PrintWriter outputWriter = commandContext.outputWriter();
outputWriter.println("Hello world!");
outputWriter.flush();
}