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

Function startForeignDaemon

e2e/desktop-packaged/linux-vm/repro.mjs:162–190  ·  view source on GitHub ↗
(home, dataDir, port)

Source from the content-addressed store, hash-verified

160 cdp.eval(`document.body && document.body.innerText.includes(${JSON.stringify(text)})`);
161
162const startForeignDaemon = (home, dataDir, port) =>
163 new Promise((resolve) => {
164 const child = spawn(
165 executorBin,
166 ["daemon", "run", "--foreground", "--port", String(port), "--hostname", "127.0.0.1"],
167 {
168 env: {
169 ...process.env,
170 HOME: home,
171 EXECUTOR_DATA_DIR: dataDir,
172 EXECUTOR_SCOPE_DIR: dataDir,
173 },
174 stdio: ["ignore", "pipe", "pipe"],
175 },
176 );
177 let err = "";
178 const timer = setTimeout(() => resolve({ child, ready: false, err }), 60_000);
179 child.stdout.on("data", (b) => {
180 if (/Daemon ready on http:\/\//.test(b.toString())) {
181 clearTimeout(timer);
182 resolve({ child, ready: true, err });
183 }
184 });
185 child.stderr.on("data", (b) => (err += b.toString()));
186 child.once("exit", () => {
187 clearTimeout(timer);
188 resolve({ child, ready: false, err });
189 });
190 });
191
192const main = async () => {
193 if (!existsSync(appExe)) fail(`app binary not found at ${appExe}`);

Callers 1

mainFunction · 0.85

Calls 2

toStringMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected