MCPcopy Create free account
hub / github.com/EvoMap/evolver / loadSpawnReplacementProcess

Function loadSpawnReplacementProcess

test/spawnReplacementProcess.test.js:19–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17// would run top-level bootstrapping and can start long-lived proxy/evolver side
18// effects before these helper-only assertions execute.
19function loadSpawnReplacementProcess() {
20 const indexPath = path.resolve(__dirname, '..', 'index.js');
21 const source = fs.readFileSync(indexPath, 'utf8');
22 const start = source.indexOf('function parseBoolEnv(');
23 const end = source.indexOf('\n// Atomic write of the cycle_progress.json file', start);
24 assert.ok(start > 0, 'expected parseBoolEnv declaration');
25 assert.ok(end > start, 'expected spawnReplacementProcess helper block');
26 const script = [
27 'const fs = require("fs");',
28 'const { spawn } = require("child_process");',
29 source.slice(start, end),
30 'module.exports = { spawnReplacementProcess };',
31 ].join('\n');
32 const context = {
33 module: { exports: {} },
34 exports: {},
35 require,
36 process,
37 console,
38 __filename: indexPath,
39 };
40 vm.runInNewContext(script, context, { filename: indexPath });
41 return context.module.exports.spawnReplacementProcess;
42}
43
44const spawnReplacementProcess = loadSpawnReplacementProcess();
45

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected