Skip to content

Commit 1bbd1a7

Browse files
committed
change priority of setting output format
1 parent 46a3f81 commit 1bbd1a7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

launch/launch/actions/execute_local.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def __init__(
173173
:param: output_format for logging each output line, supporting `str.format()`
174174
substitutions with the following keys in scope: `line` to reference the raw
175175
output line and `this` to reference this action instance.
176-
Overridden externally by the OVERRIDE_LAUNCH_OUTPUT_FORMAT envvar value.
176+
The default format can be set externally by the ROS_LAUNCH_OUTPUT_FORMAT envvar.
177177
:param: log_cmd if True, prints the final cmd before executing the
178178
process, which is useful for debugging when substitutions are
179179
involved.
@@ -201,11 +201,16 @@ def __init__(
201201
else:
202202
self.__output = tmp_output
203203

204-
self.__output_format = output_format
205-
# Check if an environment variable is set and override anything given as argument
206-
self.__output_format = os.environ.get(
207-
'OVERRIDE_LAUNCH_OUTPUT_FORMAT', self.__output_format
208-
)
204+
# We use the following priorities to determine the output_format:
205+
# 1. Passed value to the function
206+
# 2. Environment variable
207+
# 3. Default value
208+
if output_format != "[{this.process_description.final_name}] {line}":
209+
self.__output_format = output_format
210+
else:
211+
self.__output_format = os.environ.get(
212+
"ROS_LAUNCH_OUTPUT_FORMAT", output_format
213+
)
209214

210215
self.__log_cmd = log_cmd
211216
self.__cached_output = cached_output

0 commit comments

Comments
 (0)