Add a composable string-strip substitution - #997
Open
Dylan-Gallagher wants to merge 1 commit into
Open
Conversation
Signed-off-by: Dylan Gallagher <76841713+Dylan-Gallagher@users.noreply.github.com>
|
Tick the box to add this pull request to the merge queue (same as
|
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
Add a composable
StringStripSubstitution, exposed to XML and YAML frontends as$(string-strip ...).This lets a newline-terminated command result be stripped before it is composed with another substitution:
Commanditself is unchanged and continues to return raw stdout, including trailing newlines.string-stripis opt-in and also composes with launch configurations, environment variables, and other string-valued substitutions.Fixes #995.
Is this user-facing behavior change?
Yes. Python launch descriptions can use
StringStripSubstitution(value), and XML/YAML launch descriptions can use$(string-strip value). The substitution applies Python'sstr.strip()semantics, removing leading and trailing whitespace without escaping or otherwise transforming the value.Testing
launchfunctional tests passed.launch_xmlfunctional tests passed.launch_yamlfunctional tests passed.ament_copyright; compilation and diff checks pass.Did you use Generative AI?
OpenAI Codex (GPT-5) assisted with the implementation, tests, and documentation in this change. I reviewed the complete diff, reproduced the reported failure, and ran the validation listed above.
Additional Information
Stripping resolves the trailing-newline failure reported in #995. It does not make arbitrary command output safe to interpolate as Python source; quotes and backslashes still require context-appropriate handling.