Skip to content

Commit

Permalink
change priority of setting output format
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyRamone committed Sep 11, 2023
1 parent 46a3f81 commit 1bbd1a7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions launch/launch/actions/execute_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __init__(
:param: output_format for logging each output line, supporting `str.format()`
substitutions with the following keys in scope: `line` to reference the raw
output line and `this` to reference this action instance.
Overridden externally by the OVERRIDE_LAUNCH_OUTPUT_FORMAT envvar value.
The default format can be set externally by the ROS_LAUNCH_OUTPUT_FORMAT envvar.
:param: log_cmd if True, prints the final cmd before executing the
process, which is useful for debugging when substitutions are
involved.
Expand Down Expand Up @@ -201,11 +201,16 @@ def __init__(
else:
self.__output = tmp_output

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

self.__log_cmd = log_cmd
self.__cached_output = cached_output
Expand Down

0 comments on commit 1bbd1a7

Please sign in to comment.