fix: replace asyncio subprocess proxy with thread-based Popen proxy
Some checks failed
Build and Deploy iLSP / test (push) Failing after 12s
Build and Deploy iLSP / build-and-deploy (push) Has been skipped

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:
Henrik Jess Nielsen
2026-05-10 13:02:52 +02:00
parent c550a4963e
commit 6385e159ff
5 changed files with 175 additions and 139 deletions

View File

@@ -13,8 +13,8 @@ HEALTH_PORT="${HEALTH_PORT:-2089}"
PASS=0
FAIL=0
ok() { echo "$*"; ((PASS++)); }
fail() { echo "$*"; ((FAIL++)); }
ok() { echo "$*"; PASS=$((PASS+1)); }
fail() { echo "$*"; FAIL=$((FAIL+1)); }
# ── Helper: send LSP initialize and read response ─────────────────────────────
@@ -28,8 +28,14 @@ send_lsp_init() {
lsp_check() {
local name="$1"
local port="$2"
local timeout="${3:-3}"
local response
response=$(send_lsp_init "$port" | nc -w 3 "$HOST" "$port" 2>/dev/null || true)
# Keep stdin open during LSP server startup: the server must NOT see EOF
# on stdin before it has finished responding (especially slow .NET JIT).
# We send the init message and then sleep for the full timeout so that nc
# keeps the TCP write-side open while reading the server's response.
response=$({ send_lsp_init "$port"; sleep "$timeout"; } \
| nc -w "$timeout" "$HOST" "$port" 2>/dev/null || true)
if echo "$response" | grep -q '"result"'; then
ok "$name LSP responded to initialize (port $port)"
else
@@ -65,11 +71,11 @@ else
echo " ⚠ nc not found — skipping TCP tests"
fi
# 3. Bicep LSP
# 3. Bicep LSP (longer timeout — .NET startup takes a few seconds)
echo ""
echo "Bicep LSP (TCP :$BICEP_PORT)"
if command -v nc &>/dev/null; then
lsp_check "Bicep" "$BICEP_PORT"
lsp_check "Bicep" "$BICEP_PORT" 12
fi
# ── Summary ───────────────────────────────────────────────────────────────────