Skip to content

Commit 7fd8ec2

Browse files
author
Roger Strain
committed
Unit test fixes
Distro A; OPSEC #4584 Signed-off-by: Roger Strain <[email protected]>
1 parent 797a6e8 commit 7fd8ec2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

launch/launch/actions/execute_process.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(
4343
self,
4444
*,
4545
cmd: Iterable[SomeSubstitutionsType],
46+
prefix: Optional[SomeSubstitutionsType] = None,
4647
name: Optional[SomeSubstitutionsType] = None,
4748
cwd: Optional[SomeSubstitutionsType] = None,
4849
env: Optional[Dict[SomeSubstitutionsType, SomeSubstitutionsType]] = None,
@@ -143,7 +144,7 @@ def __init__(
143144
Defaults to 'False'.
144145
:param: respawn_delay a delay time to relaunch the died process if respawn is 'True'.
145146
"""
146-
self.__executable = Executable(cmd=cmd, name=name, cwd=cwd, env=env,
147+
self.__executable = Executable(cmd=cmd, prefix=prefix, name=name, cwd=cwd, env=env,
147148
additional_env=additional_env)
148149
super().__init__(process_description=self.__executable, **kwargs)
149150

@@ -286,21 +287,29 @@ def parse(
286287
@property
287288
def name(self):
288289
"""Getter for name."""
290+
if self.__executable.final_name is not None:
291+
return self.__executable.final_name
289292
return self.__executable.name
290293

291294
@property
292295
def cmd(self):
293296
"""Getter for cmd."""
297+
if self.__executable.final_cmd is not None:
298+
return self.__executable.final_cmd
294299
return self.__executable.cmd
295300

296301
@property
297302
def cwd(self):
298303
"""Getter for cwd."""
304+
if self.__executable.final_cwd is not None:
305+
return self.__executable.final_cwd
299306
return self.__executable.cwd
300307

301308
@property
302309
def env(self):
303310
"""Getter for env."""
311+
if self.__executable.final_env is not None:
312+
return self.__executable.final_env
304313
return self.__executable.env
305314

306315
@property

launch/launch/descriptions/executable.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ def __init__(
9292
self.__additional_env.append((
9393
normalize_to_list_of_substitutions(key),
9494
normalize_to_list_of_substitutions(value)))
95+
self.__final_cmd = None
96+
self.__final_cwd = None
97+
self.__final_env = None
98+
self.__final_name = None
9599

96100
@property
97101
def name(self):
@@ -162,7 +166,7 @@ def __expand_substitutions(self, context):
162166
with _executable_process_counter_lock:
163167
global _executable_process_counter
164168
_executable_process_counter += 1
165-
self.__final_name = f":{name}-{_executable_process_counter}"
169+
self.__final_name = f"{name}-{_executable_process_counter}"
166170
cwd = None
167171
if self.__cwd is not None:
168172
cwd = ''.join([context.perform_substitution(x) for x in self.__cwd])

0 commit comments

Comments
 (0)