Merged
Conversation
`console.error` does not always have the same buffering settings as `console.log` and so printing to both does not always cause output to be shown in the intended order. `console.error` should only be used for real errors that happen elsewhere.
`process.exit` quits immediately, without allowing buffered output from say, a `console.log` to be printed. See these Node.js issues: nodejs/node#3669 nodejs/node#3170 nodejs/node#2972 (comment)
Contributor
|
👍 |
orangejulius
added a commit
to pelias/pip-service
that referenced
this pull request
Oct 24, 2017
Using `process.exit` directly can cause output to stderr/stdout to be truncated, since it [does not wait for output to streams to be sent](https://nodejs.org/api/process.html#process_process_exit_code). This probably isn't an issue here for the PIP service, but it's worth avoiding it since explicitly closing the HTTP server created by express is easy, and will cause the process to quit "naturally", as nothing else is running. We did actually run into this issue in the [fuzzy-tester](pelias/fuzzy-tester#44) and it's a pain to track down.
orangejulius
added a commit
to pelias/pip-service
that referenced
this pull request
Oct 24, 2017
Using `process.exit` directly can cause output to stderr/stdout to be truncated, since it [does not wait for output to streams to be sent](https://nodejs.org/api/process.html#process_process_exit_code). This probably isn't an issue here for the PIP service, but it's worth avoiding it since explicitly closing the HTTP server created by express is easy, and will cause the process to quit "naturally", as nothing else is running. We did actually run into this issue in the [fuzzy-tester](pelias/fuzzy-tester#44) and it's a pain to track down.
orangejulius
added a commit
to pelias/pip-service
that referenced
this pull request
Dec 1, 2017
Using `process.exit` directly can cause output to stderr/stdout to be truncated, since it [does not wait for output to streams to be sent](https://nodejs.org/api/process.html#process_process_exit_code). This probably isn't an issue here for the PIP service, but it's worth avoiding it since explicitly closing the HTTP server created by express is easy, and will cause the process to quit "naturally", as nothing else is running. We did actually run into this issue in the [fuzzy-tester](pelias/fuzzy-tester#44) and it's a pain to track down.
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.
The output from the fuzzy-tester is sometimes truncated, it turns out
process.exitis unsafe to use just after a bunch of bigconsole.logs. Instead process.exitCode should be used. See these Node.js issues:nodejs/node#3669
nodejs/node#3170
nodejs/node#2972 (comment)
Note: after this is merged I'm going to backport it to the 0.5 branch and release 0.5.2 to be used with our acceptance tests right awayUpdate: it doesn't need to be backported afterall!