-
-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write error information to STDERR #4799
Write error information to STDERR #4799
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me! Not sure if this has any other ripple effects in the ecosystem, but LGTM.
Thank you, @malsf21 Even if there are adverse effects from this change, there is a workaround, so the ripple effect should be small. Redirecting the standard error output to standard output as follows gives the same behavior as before. stylelint "**/*.css" 2>&1 It's hard to separate the information once it's mixed, but it's easy to mix the information that's separated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @naokikimura!
I've made a couple of stylistic changes while keeping your changed functionality.
This looks good to me 👍
@@ -534,10 +534,10 @@ module.exports = (argv) => { | |||
* @returns {void} | |||
*/ | |||
function handleError(err) { | |||
console.log(err.stack); // eslint-disable-line no-console | |||
process.stderr.write(err.stack); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this from console.error
to process.stderr.write
. This is consistent with other errors earlier in the file, and means we can remove the // eslint-disable-line
comment.
const exitCode = typeof err.code === 'number' ? err.code : 1; | ||
|
||
process.exit(exitCode); // eslint-disable-line no-process-exit | ||
process.exitCode = exitCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set an exitCode and wait for node to exit when any pending work is complete. This means we can remove another // eslint-disable-line
comment. The node docs recommend against using process.exit()
where possible.
Thank you @m-allanson I look forward to the quick release of this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM
Updated changelog:
|
Since [version 13.6.0](https://github.com/stylelint/stylelint/blob/804bb24c75248aba55b009994e4bfb561593a990/CHANGELOG.md?plain=1#L654), following [PR 4799](stylelint/stylelint#4799) `stylelint` errors are sent to `stderr`. Previous versions where sending errors to `stdout`.
Since [version 13.6.0](https://github.com/stylelint/stylelint/blob/804bb24c75248aba55b009994e4bfb561593a990/CHANGELOG.md?plain=1#L654), following [PR 4799](stylelint/stylelint#4799) `stylelint` errors are sent to `stderr`. Previous versions where sending errors to `stdout`.
Closes #4798
No, it's self-explanatory.