Skip trailing newline when printing token to a terminal#31
Open
LRitzdorf wants to merge 2 commits into
Open
Conversation
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
3cb2314 to
383ca0f
Compare
Author
|
This is what I get for using a more recent version of Go locally... |
alexlovelltroy
approved these changes
Jun 26, 2026
alexlovelltroy
left a comment
Member
There was a problem hiding this comment.
The code looks very reasonable here, but I haven't had a chance to test anywhere.
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.
Description
When printing user tokens (i.e.
user-token create), a trailing newline is included to make terminal output cleaner. This is usually fine, but some automations take the raw output (including newline) and pass it to other tools that might not expect it, e.g. curl (which gets mad when you try to include a newline in a header field).This behavior was hidden for a while since bash's command substitution strips the newline; you need to be working in a semi-low-level language to actually pass it on to other commands down the chain.
Also, I've applied a similar fix to
bootstrap-token create's JSON output mode in particular. Most tools parsing the JSON will probably be fine with a newline, but omitting it certainly can't hurt.Fixes #30
Type of Change
I don't actually have a working OpenCHAMI environment on hand, so I can't immediately test this. It'd be appreciated if someone else could check that nothing explodes as a result :)