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

stderr.write(): add newline suffix consistently #1414

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Feb 19, 2025

Noted while investigating #1403.

Some logging is not followed by a newline character, so it is concatenated with the next output to stderr.

This commit adds newline characters to calls to process.stderr.write() where missing, and standardises their inclusion.

What has been done to verify that this works as intended?

Run locally; tests in CI.

Why is this the best possible solution? Were any other approaches considered?

Introduced in f3e8563, it's unclear why process.stderr.write() is used in preference to console.error().

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No change for users, unless they're parsing stderr for e.g. monitoring. This change would probably make parsing more reliable.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

I don't think stderr output is currently documented.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

alxndrsn and others added 2 commits February 19, 2025 08:20
Noted while investigating getodk#1403

Some logging is not followed by a newline character, so it is concatenated with the next output to stderrr.

This commit adds newline characters to calls to process.stderr.write() where missing, and standardises their inclusion.

It's unclear why `process.stderr.write()` is used in preference to `console.error()`
@alxndrsn alxndrsn marked this pull request as ready for review February 19, 2025 08:37
@matthew-white
Copy link
Member

I don't think stderr output is currently documented.

Yes, I think that's right. 👍

@matthew-white
Copy link
Member

it's unclear why process.stderr.write() is used in preference to console.error().

I remember asking about this during code review several years ago. issa thought that the two did different things. Sorry, I don't remember anything more specific. 😅 Maybe the two aren't different anymore? console.error() does seem nicer.

@alxndrsn alxndrsn merged commit bb6849d into getodk:master Feb 20, 2025
7 checks passed
@alxndrsn alxndrsn deleted the stderr-write-newline branch February 20, 2025 05:36
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