Skip to content

Commit 4fb402c

Browse files
[spawner] Fix Lock timeout error crashes (#2386)
1 parent e905c07 commit 4fb402c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

controller_manager/controller_manager/spawner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def main(args=None):
160160
switch_timeout = args.switch_timeout
161161
strictness = SwitchController.Request.STRICT
162162
unload_controllers_upon_exit = False
163+
node = None
163164

164165
if param_files:
165166
for param_file in param_files:
@@ -190,7 +191,7 @@ def main(args=None):
190191
time.sleep(retry_delay)
191192
else:
192193
logger.error(
193-
bcolors.ERROR + "Failed to acquire lock after multiple attempts." + bcolors.ENDC
194+
bcolors.FAIL + "Failed to acquire lock after multiple attempts." + bcolors.ENDC
194195
)
195196
return 1
196197

@@ -378,7 +379,8 @@ def main(args=None):
378379
logger.fatal(str(err))
379380
return 1
380381
finally:
381-
node.destroy_node()
382+
if node:
383+
node.destroy_node()
382384
lock.release()
383385
rclpy.shutdown()
384386

0 commit comments

Comments
 (0)