chore: warn to stdout instead of stderr #580
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Please always log actionable text to
STDOUT
instead ofSTDERR
. As per The Open Group Base Specification on standard streams,stderr
is used to indicate a non-zero exit code. Some package managers like rush considerstderr
output to indicate a non-zero exit status and probably others do as well following a convention to return the highestFILENO
that is used as the exit status.Notable verbiage
I think the intention of the outdated
caniuse-lite
package warning is to provide actionable next steps to the user and not create an implied exit status when displayed.Supporting evidence
Searching Stack Overflow for the text
Browserslist: caniuse-lite is outdated
reveals many users confused why their builds are breaking and probably trying to do the right thing which is update their dependencies. However I think it's worthwhile to consider the implications of which stream is being used and what exit status that implies.Reproducible steps
rush
project that has an outdatedcaniuse-lite
browser listbuild
script rush will invoke using built-in command and will generates the warning (similar tolerna run build
butbuild
is sugar the script name. (note: the built-in command will use the default settings)dist
)rush build
target and npm script and the with&&
(example)rush build && pnpm run dist
Expected
dist
was runActual
dist
will not run as a non-zero exit status short circuits the logical expressionChangelog
console.warn
withconsole.info
in regardsinfo
Thanks so much for your time in considering this PR and I hope I speak for other users and not just my little corner of the world with the Rush Stack.