ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
126 stars 142 forks source link

Add AppendEnvironmentVariable action #543

Closed christophebedard closed 3 years ago

christophebedard commented 3 years ago

Closes #542

This adds an AppendEnvironmentVariable action that is similar to SetEnvironmentVariable. However, if the environment variable already exists, it appends the given value using a platform-specific separator, like: VAR=/some/path:/other/path.

It also has an option to prepend instead.

Signed-off-by: Christophe Bedard bedard.christophe@gmail.com

christophebedard commented 3 years ago

I copied SetEnvironmentVariable's setup, but I'm still getting circular import errors. Seems like the import order in actions/__init__.py matters.

christophebedard commented 3 years ago

you can achieve the same by combining the SetEnvironmentVariable action and the EnvironmentVariable substitution (though it's much more verbose).

I did realize this after submitting the PR, but yeah it's pretty verbose. And it might lead to an extra separator, although that probably doesn't matter.

christophebedard commented 3 years ago

thanks @hidmic!

hidmic commented 3 years ago

Alright, going in! Thank you for your patience @christophebedard.

christophebedard commented 3 years ago

@hidmic I'm using this new feature for ros2_tracing (as of https://gitlab.com/ros-tracing/ros2_tracing/-/merge_requests/269), so if we could get a new release of launch to fix the ros2_tracing Rdev job that would be appreciated!