MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitGuestHttp

Function waitGuestHttp

e2e/setup/desktop-vm.ts:17–27  ·  view source on GitHub ↗
(vm: VmHandle, url: string, attempts = 60)

Source from the content-addressed store, hash-verified

15 * owned by root (launchctl asuser), whose listening socket an unprivileged lsof
16 * can't see — a loopback HTTP probe works regardless of owner. */
17export const waitGuestHttp = async (vm: VmHandle, url: string, attempts = 60): Promise<boolean> => {
18 for (let i = 0; i < attempts; i++) {
19 const r = await vm.ssh(
20 `curl -s -o /dev/null -w '%{http_code}' --max-time 5 ${url} 2>/dev/null || echo 000`,
21 );
22 const code = r.stdout.trim().slice(-3);
23 if (code !== "000" && code !== "") return true;
24 await sleep(2000);
25 }
26 return false;
27};
28
29/** Poll until CDP advertises a real PAGE target — i.e. the app's window/renderer
30 * is up, not just the browser endpoint. On a cold guest the page appears a good

Callers 2

provisionMacFunction · 0.90
provisionLinuxFunction · 0.90

Calls 2

sshMethod · 0.80
sleepFunction · 0.70

Tested by

no test coverage detected