From 596c1958e6ab9b9f8d7805852cb9e602760db2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 8 Aug 2024 18:19:57 +0200 Subject: [PATCH] Add short message on finished command --- github_app_geo_project/module/utils.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/github_app_geo_project/module/utils.py b/github_app_geo_project/module/utils.py index e043c3bc044..626addad6a2 100644 --- a/github_app_geo_project/module/utils.py +++ b/github_app_geo_project/module/utils.py @@ -511,14 +511,17 @@ async def run_timeout( start = datetime.datetime.now() try: async with asyncio.timeout(timeout): - async_proc = await asyncio.create_subprocess_exec( - *command, - cwd=cwd or get_cwd(), - env=env, - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE, - ) - stdout, stderr = await async_proc.communicate() + try: + async_proc = await asyncio.create_subprocess_exec( + *command, + cwd=cwd or get_cwd(), + env=env, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + ) + stdout, stderr = await async_proc.communicate() + finally: + _LOGGER.debug("Command %s finished", shlex.join(command)) assert async_proc.returncode is not None message: Message = AnsiProcessMessage( command, async_proc.returncode, stdout.decode(), stderr.decode()