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

Function readToken

e2e/local/vite-dev-routing.test.ts:40–51  ·  view source on GitHub ↗
(dataDir: string)

Source from the content-addressed store, hash-verified

38 });
39
40const readToken = async (dataDir: string): Promise<string> => {
41 const path = join(dataDir, "server-control", "auth.json");
42 const deadline = Date.now() + 30_000;
43 while (Date.now() < deadline) {
44 if (existsSync(path)) {
45 const parsed = JSON.parse(readFileSync(path, "utf8")) as { readonly token?: unknown };
46 if (typeof parsed.token === "string") return parsed.token;
47 }
48 await new Promise((resolve) => setTimeout(resolve, 100));
49 }
50 throw new Error(`Vite dev did not mint ${path}`);
51};
52
53const stopTree = async (child: ChildProcess): Promise<void> => {
54 if (child.pid === undefined || child.exitCode !== null) return;

Callers 1

startPlainViteDevFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected