From 231f113acb4c4db2598f64353be4c2d8b0d1df93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Mon, 12 Feb 2024 20:43:07 -0300 Subject: [PATCH] core: services: ardupilot_manager: AbstractRouter: Add better message if router fails to start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- .../ardupilot_manager/mavlink_proxy/AbstractRouter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/services/ardupilot_manager/mavlink_proxy/AbstractRouter.py b/core/services/ardupilot_manager/mavlink_proxy/AbstractRouter.py index 27476ff17e..9feb63bf9a 100644 --- a/core/services/ardupilot_manager/mavlink_proxy/AbstractRouter.py +++ b/core/services/ardupilot_manager/mavlink_proxy/AbstractRouter.py @@ -104,7 +104,12 @@ async def start(self, master_endpoint: Endpoint) -> None: await asyncio.sleep(3) # Non-blocking sleep if not await self.is_running(): - raise MavlinkRouterStartFail("Failed to initialize Mavlink router") + _stdout, _strerr = await self._subprocess.communicate() + stdout = _stdout.decode("utf-8") if _stdout else "No stdout." + stderr = _strerr.decode("utf-8") if _strerr else "No stderr." + output = f"message: stdout: '{stdout}', stderr: '{stderr}'" + returncode = self._subprocess.returncode + raise MavlinkRouterStartFail(f"Failed to initialize Mavlink router, code: {returncode}, {output}") await self.start_house_keepers() async def exit(self) -> None: