MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / waitForServer

Function waitForServer

scripts/dev-safe.mjs:1137–1154  ·  view source on GitHub ↗
(url, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS)

Source from the content-addressed store, hash-verified

1135}
1136
1137async function waitForServer(url, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS) {
1138 const startedAt = Date.now();
1139
1140 while (Date.now() - startedAt < timeoutMs) {
1141 try {
1142 const response = await fetch(url);
1143 if (response.ok) {
1144 return;
1145 }
1146 } catch {
1147 // Keep polling until timeout.
1148 }
1149
1150 await delay(500);
1151 }
1152
1153 throw new Error(`Timed out waiting for agent-server at ${url}`);
1154}
1155
1156function spawnProcess(command, args, options = {}) {
1157 const child = spawn(

Callers 1

mainFunction · 0.70

Calls 1

delayFunction · 0.85

Tested by

no test coverage detected