fix: replace asyncio subprocess proxy with thread-based Popen proxy
asyncio subprocess PIPE unreliable for long-lived stdio bridging. Use Popen + threads instead. Also fix smoke_test.sh stdin handling.
This commit is contained in:
@@ -11,6 +11,7 @@ import asyncio
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import threading
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
@@ -58,13 +59,23 @@ async def main_async() -> None:
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
||||
)
|
||||
logging.getLogger("ilsp.bicep_lsp.proxy").setLevel(logging.DEBUG)
|
||||
|
||||
# Pre-warm caches
|
||||
logger.info("Pre-warming catalogs…")
|
||||
from .bicep_lsp.modules import BicepModuleCatalog
|
||||
await asyncio.gather(
|
||||
PypiCatalog.start_background_refresh(),
|
||||
BicepModuleCatalog.start_background_refresh(),
|
||||
)
|
||||
|
||||
# Start Bicep LSP proxy in a daemon thread (blocking socket server)
|
||||
threading.Thread(
|
||||
target=serve_bicep,
|
||||
args=(BICEP_LSP_PORT,),
|
||||
daemon=True,
|
||||
).start()
|
||||
|
||||
# Build health app
|
||||
health_app = await _health_app()
|
||||
runner = web.AppRunner(health_app)
|
||||
@@ -73,11 +84,8 @@ async def main_async() -> None:
|
||||
await site.start()
|
||||
logger.info("Health endpoint on http://0.0.0.0:%d/health", HEALTH_PORT)
|
||||
|
||||
# Run all services
|
||||
await asyncio.gather(
|
||||
_serve_python_lsp(PYTHON_LSP_PORT),
|
||||
serve_bicep(BICEP_LSP_PORT),
|
||||
)
|
||||
# Run remaining asyncio services
|
||||
await _serve_python_lsp(PYTHON_LSP_PORT)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
Reference in New Issue
Block a user