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

Function waitForServer

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

Source from the content-addressed store, hash-verified

783}
784
785async function waitForServer(url, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS) {
786 const startedAt = Date.now();
787
788 while (Date.now() - startedAt < timeoutMs) {
789 try {
790 const response = await fetch(url);
791 if (response.ok) {
792 return;
793 }
794 } catch {
795 // Keep polling until timeout.
796 }
797
798 await delay(500);
799 }
800
801 throw new Error(`Timed out waiting for agent-server at ${url}`);
802}
803
804function spawnProcess(command, args, options = {}) {
805 const child = spawn(

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected