Skip to content
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

Fixing truncated error output #11

Merged
merged 1 commit into from
Feb 28, 2017
Merged

Conversation

Sequoia
Copy link
Contributor

@Sequoia Sequoia commented Oct 6, 2016

This is a big annoying old bug that's been around forever apparently. On some systems (mac here, apparently affects windows as well), the following will not work as expected:

console.log(veryLongString);
process.exit();

Console.log is sync but output buffering (writing to stdout stream) is async, so:

  • Tick + 0 first chunk is written
  • Tick + 1 process.exit()
  • Tick + 2 second chunk is written ❌ Never runs

The solution is to pass process.exit as a callback to process.stderr (where console.error goes).

Before

$ markdownlint _includes/readmes/loopback-example-access-control.md
_includes/readmes/loopback-example-access-control.md: 1: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 22: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 24: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 31: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 39: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 41: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 43: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 54: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 56: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 97: MD018 No space after h%
$

After

$ markdownlint _includes/readmes/loopback-example-access-control.md
_includes/readmes/loopback-example-access-control.md: 1: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 22: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 24: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 31: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 39: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 41: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 43: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 54: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 56: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 97: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 105: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 107: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 131: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 146: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 163: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 174: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 180: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 189: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 193: MD018 No space after hash on atx style header
_includes/readmes/loopback-example-access-control.md: 239: MD018 No space after hash on atx style header%
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants