rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

Move CLI information output to stderr for install-run-rush

Open M3kH opened this issue 4 years ago • 6 comments

Summary

Trying to solve #2607 by forward informational CLI output on stderr

Details

Rather than using and stdout for informational output we want to use sterr, this is also the right usage for the stderr. We can read more about it here: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html

At program start-up, three streams shall be predefined and need not be opened explicitly: standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output).

M3kH avatar Apr 20 '21 09:04 M3kH

CLA assistant check
All CLA requirements met.

ghost avatar Apr 20 '21 09:04 ghost

This isn't a solution to #2607. These are informational messages that should be printed to stdout. When the --json flag is passed, those messages should be suppressed.

Can we discuss in-person tomorrow? I think I have a good solution, but I'd like to discuss it first.

iclanton avatar Apr 21 '21 09:04 iclanton

This isn't a solution to #2607. These are informational messages that should be printed to stdout. When the --json flag is passed, those messages should be suppressed.

Can we discuss in-person tomorrow? I think I have a good solution, but I'd like to discuss it first.

@iclanton I don't think you want to discuss with me right? 😅 otherwise sure I can make time.

M3kH avatar Apr 21 '21 12:04 M3kH

@M3kH - lol sorry, I started typing that response, got distracted, and then typed something I meant to type to someone else.

You want to fix this issue by completely suppressing the banner messages, not just print them to a different stream. The easiest way to do that may be to add a feature to ts-command-line where a flag parameter can be marked as causing the tool to produce machine-readable output. Then you can plumb its inclusion to a property or function in the action class and the CommandLineParser class directing the tool not to print anything but the machine-readable output.

iclanton avatar Apr 22 '21 18:04 iclanton

#2777 is looking at an alternate approach to the problem, namely it is turning off the logging from install-run-rush.js altogether unless --debug or -d is passed on the command line, and only printing the output of the underlying command. This combines with an ability to disable Rush's own additional boilerplate logging with a configuration parameter in the action schema.

dmichon-msft avatar Jun 30 '21 00:06 dmichon-msft

@dmichon-msft indeed I think that is a better solution. I will still consider not using stdout for debugging purposes, which is a practice of many CLI tools.

M3kH avatar Jun 30 '21 09:06 M3kH