Skip to content

Commit 32dbb67

Browse files
authored
Use asyncio.wait with timeout rather than sleep (#576)
The latter approach seems to hang with Python 3.6. Signed-off-by: Scott K Logan <[email protected]>
1 parent 84ab8be commit 32dbb67

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

launch/launch/actions/execute_local.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,9 @@ async def __execute_process(self, context: LaunchContext) -> None:
574574
# wait for a timeout(`self.__respawn_delay`) to respawn the process
575575
# and handle shutdown event with future(`self.__shutdown_future`)
576576
# to make sure `ros2 launch` exit in time
577-
respawn_task = asyncio.create_task(asyncio.sleep(self.__respawn_delay))
578577
await asyncio.wait(
579-
[respawn_task, self.__shutdown_future],
580-
return_when=asyncio.FIRST_COMPLETED
578+
(self.__shutdown_future,),
579+
timeout=self.__respawn_delay
581580
)
582581
if not self.__shutdown_future.done():
583582
context.asyncio_loop.create_task(self.__execute_process(context))

0 commit comments

Comments
 (0)