Skip to content

fix: Missing trailing newline when using both --multi and --string options #819

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sam-C
Copy link

@Sam-C Sam-C commented Aug 7, 2025

Problem

when using both --multi and --string options, the output does not have a trailing newline.

The output has trailing newline when

  • using neither --multi or --string option
  • using only --multi option
  • using only --string option

Reproducible with:

$ jsonnet-v0.21.0 -e '{"outfile": "x"}' --multi . --string && cat outfile | xxd
00000000: 78                                       x

xxd shows that the outfile ends with 0x78 or the x character.

Expected:

$ jsonnet -e '{"output.json": "xxxxx"}' -m . -S && tail ms.json -c 1 | xxd
00000000: 780a                                     x.

xxd shows that the outfile ends with 0x0a which is the newline/line-feed (LF) character.

Closes #518

Copy link

google-cla bot commented Aug 7, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Sam-C Sam-C marked this pull request as ready for review August 7, 2025 07:52
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.

Make trailing newline behavior consistent with c++ version
1 participant