MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _run_async

Function _run_async

src/context_system/builder.py:48–62  ·  view source on GitHub ↗

Run an async function synchronously, handling nested event loops.

(coro)

Source from the content-addressed store, hash-verified

46
47
48def _run_async(coro):
49 """Run an async function synchronously, handling nested event loops."""
50 try:
51 loop = asyncio.get_running_loop()
52 except RuntimeError:
53 loop = None
54
55 if loop is not None and loop.is_running():
56 # Already in an async context — create a new thread
57 import concurrent.futures
58 with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
59 future = pool.submit(asyncio.run, coro)
60 return future.result(timeout=10)
61 else:
62 return asyncio.run(coro)
63
64
65def _build_workspace_section(root: Path, current: Path) -> str:

Callers 2

_build_git_sectionFunction · 0.85
_build_claude_md_sectionFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected