OpenSearch/distribution/tools
William Brafford 2b549e7342
CLI tools: write errors to stderr instead of stdout (#45586)
Most of our CLI tools use the Terminal class, which previously did not provide methods for writing to standard output. When all output goes to standard out, there are two basic problems. First, errors and warnings are "swallowed" in pipelines, making it hard for a user to know when something's gone wrong. Second, errors and warnings are intermingled with legitimate output, making it difficult to pass the results of interactive scripts to other tools.

This commit adds a second set of print commands to Terminal for printing to standard error, with errorPrint corresponding to print and errorPrintln corresponding to println. This leaves it to developers to decide which output should go where. It also adjusts existing commands to send errors and warnings to stderr.

Usage is printed to standard output when it's correctly requested (e.g., bin/elasticsearch-keystore --help) but goes to standard error when a command is invoked incorrectly (e.g. bin/elasticsearch-keystore list-with-a-typo | sort).
2019-08-21 14:46:07 -04:00
..
java-version-checker [Backport] Replace usages RandomizedTestingTask with built-in Gradle Test (#40978) (#40993) 2019-04-09 11:52:50 -07:00
launchers Disable netty direct buffer pooling by default (#44837) 2019-08-08 15:10:31 -06:00
plugin-cli CLI tools: write errors to stderr instead of stdout (#45586) 2019-08-21 14:46:07 -04:00