Skip to content

Commit

Permalink
Launch actions sychronously
Browse files Browse the repository at this point in the history
There's no need to run asychronously and manually send a shutdown signal.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Aug 11, 2020
1 parent 074bdac commit 782776c
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,11 @@ def shutdown(self):
self._thread.join()


def _assert_launch_no_errors(actions, *, timeout_sec=1):
def _assert_launch_no_errors(actions):
ld = LaunchDescription(actions)
ls = LaunchService(debug=True)
ls.include_launch_description(ld)

loop = osrf_pycommon.process_utils.get_loop()
launch_task = loop.create_task(ls.run_async())
loop.run_until_complete(asyncio.sleep(timeout_sec))
if not launch_task.done():
loop.create_task(ls.shutdown())
loop.run_until_complete(launch_task)
assert 0 == launch_task.result()
assert 0 == ls.run()
return ls.context


Expand Down

0 comments on commit 782776c

Please sign in to comment.