Skip to content

Commit

Permalink
fix: Workaround CancelledError on windows (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp authored Sep 4, 2024
1 parent 355ebb0 commit 2aceca4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gallia/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,14 @@ async def _db_finish_run_meta(self) -> None:

try:
await self.db_handler.disconnect()
# CancelledError appears only on windows; it is unclear why this happens…
except Exception as e:
logger.error(f"Could not close the database connection properly: {e!r}")
except asyncio.exceptions.CancelledError as e:
logger.error(f"BUG: {e!r} occured. This only seems to happen on windows")
logger.error(
"If you can reproduce this, open an issue: https://github.com/Fraunhofer-AISEC/gallia"
)

def _dump_environment(self, path: Path) -> None:
environ = cast(dict[str, str], os.environ)
Expand Down

0 comments on commit 2aceca4

Please sign in to comment.