74
74
from ..utilities .type_utils import normalize_typed_substitution
75
75
from ..utilities .type_utils import perform_typed_substitution
76
76
77
- DEFAULT_OUTPUT_FORMAT = '[{this.process_description.final_name}] {line}'
78
-
79
77
80
78
class ExecuteLocal (Action ):
81
79
"""Action that begins executing a process on the local system and sets up event handlers."""
@@ -91,7 +89,7 @@ def __init__(
91
89
'sigkill_timeout' , default = 5 ),
92
90
emulate_tty : bool = False ,
93
91
output : SomeSubstitutionsType = 'log' ,
94
- output_format : Text = DEFAULT_OUTPUT_FORMAT ,
92
+ output_format : Text = '[{this.process_description.final_name}] {line}' ,
95
93
cached_output : bool = False ,
96
94
log_cmd : bool = False ,
97
95
on_exit : Optional [Union [
@@ -175,6 +173,7 @@ def __init__(
175
173
:param: output_format for logging each output line, supporting `str.format()`
176
174
substitutions with the following keys in scope: `line` to reference the raw
177
175
output line and `this` to reference this action instance.
176
+ Overridden externally by the OVERRIDE_LAUNCH_OUTPUT_FORMAT envvar value.
178
177
:param: log_cmd if True, prints the final cmd before executing the
179
178
process, which is useful for debugging when substitutions are
180
179
involved.
@@ -202,13 +201,11 @@ def __init__(
202
201
else :
203
202
self .__output = tmp_output
204
203
205
- # Check if an environment variable is set and use this as a default
204
+ self .__output_format = output_format
205
+ # Check if an environment variable is set and override anything given as argument
206
206
self .__output_format = os .environ .get (
207
- 'LAUNCH_OUTPUT_FORMAT ' , output_format
207
+ 'OVERRIDE_LAUNCH_OUTPUT_FORMAT ' , self . __output_format
208
208
)
209
- # Setting it locally in the launch file still overwrites the default
210
- if output_format != DEFAULT_OUTPUT_FORMAT :
211
- self .__output_format = output_format
212
209
213
210
self .__log_cmd = log_cmd
214
211
self .__cached_output = cached_output
0 commit comments