Skip to content

Commit c3abc68

Browse files
committed
Attempted fix for codeql-path-tests on windows-latest
1 parent e8ebe6a commit c3abc68

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

server/scripts/test-codeql-path-valid.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,45 @@ echo " Server PID: ${SERVER_PID}"
111111
# Give the server time to either start successfully or crash
112112
sleep 5
113113

114-
if kill -0 "${SERVER_PID}" 2>/dev/null; then
114+
# Helper: check whether stderr proves the server started successfully and
115+
# resolved the CodeQL CLI via CODEQL_PATH.
116+
check_startup_logs() {
115117
echo ""
116118
echo "--- startup logs ---"
117119
cat "${STDERR_FILE}"
118120

119-
# Verify stderr confirms CODEQL_PATH was used
120121
if grep -q "CODEQL_PATH" "${STDERR_FILE}"; then
121122
echo "✅ Server logged CODEQL_PATH resolution"
122123
else
123124
echo "⚠️ CODEQL_PATH not mentioned in stderr (non-fatal)"
124125
fi
125126

127+
# The definitive success marker logged by the server
128+
if grep -q "McpServer started successfully" "${STDERR_FILE}"; then
129+
return 0
130+
fi
131+
return 1
132+
}
133+
134+
if kill -0 "${SERVER_PID}" 2>/dev/null; then
135+
check_startup_logs
126136
echo ""
127137
echo "✅ PASS: Server is running after 5 seconds (PID ${SERVER_PID})"
128138
# Cleanup is handled by the EXIT trap
129139
exit 0
130140
else
131141
wait "${SERVER_PID}" 2>/dev/null && EXIT_CODE=0 || EXIT_CODE=$?
142+
143+
# On Windows, mkfifo is unavailable and the process-substitution fallback
144+
# may not keep stdin open reliably. When the STDIO transport receives EOF
145+
# the server shuts down cleanly (exit 0) even though startup succeeded.
146+
# Accept that as a pass when the logs prove the server started correctly.
147+
if [[ "${EXIT_CODE}" -eq 0 ]] && check_startup_logs; then
148+
echo ""
149+
echo "✅ PASS: Server started successfully (exited cleanly after stdin EOF)"
150+
exit 0
151+
fi
152+
132153
echo ""
133154
echo "::error::Server exited prematurely with code ${EXIT_CODE}"
134155
echo "--- stderr ---"

0 commit comments

Comments
 (0)