fix(cli): avoid truncated output on macOS#503
Merged
marionebl merged 1 commit intoconventional-changelog:masterfrom Nov 30, 2018
Merged
fix(cli): avoid truncated output on macOS#503marionebl merged 1 commit intoconventional-changelog:masterfrom
marionebl merged 1 commit intoconventional-changelog:masterfrom
Conversation
Use console.log() instead of process.stdout.write() will avoid potential output truncation on macOS.
Member
|
Great! I think I might have caused it when developing the ability to add custom formatters. The reason why I used |
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use console.log() instead of process.stdout.write() will avoid potential output truncation on macOS.
Description
Replace usage of
process.stdout.write()withconsole.log().Motivation and Context
I noticed this first when using
commitlintwithhusky:I confirmed this wasn't a
husky-specific issue by simply piping STDIN:On macOS, if output is truncated--the
nodeprocess quits before the STDOUT stream has ended--we will see a%.I then confirmed this happens in
master:I went and looked for the message in the codebase, and found it was output via a call to
process.stdout.write(), which was the likely culprit.How Has This Been Tested?
"Works on my machine":
I could write a test that asserts output isn't truncated, but I couldn't be sure that it wouldn't be flaky.
I couldn't find a reason why
process.stdout.write()was used in the first place, which is the main risk with merging this. That said, it seems relatively safe to me. You be the judge.Types of changes
Checklist: