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

Function runReaderInChild

test/evolveCollect.test.js:1000–1023  ·  view source on GitHub ↗
(home, extraEnv)

Source from the content-addressed store, hash-verified

998 // `getAgentSessionsDir()`) are evaluated at require() time, so we
999 // can't just override `process.env` in the parent process.
1000 function runReaderInChild(home, extraEnv) {
1001 const script = `
1002 const collect = require(${JSON.stringify(path.resolve(__dirname, '..', 'src', 'evolve', 'pipeline', 'collect.js'))});
1003 process.stdout.write(collect.readRealSessionLog());
1004 `;
1005 const env = {
1006 ...process.env,
1007 HOME: home,
1008 USERPROFILE: home,
1009 EVOLVER_REPO_ROOT: home,
1010 EVOLVER_NO_PARENT_GIT: 'true',
1011 EVOLVER_QUIET_PARENT_GIT: '1',
1012 EVOLVER_SESSION_SOURCE: 'cursor',
1013 OPENCLAW_WORKSPACE: home,
1014 AGENT_SESSIONS_DIR: path.join(home, '__no-openclaw__'),
1015 // Make sure the explicit override does NOT win for these tests —
1016 // we're exercising the new default-discovery path.
1017 EVOLVER_CURSOR_TRANSCRIPTS_DIR: '',
1018 ...(extraEnv || {}),
1019 };
1020 const res = spawnSync(process.execPath, ['-e', script], { env, encoding: 'utf8' });
1021 if (res.status !== 0) throw new Error('child failed: ' + (res.stderr || res.stdout));
1022 return res.stdout;
1023 }
1024
1025 function writeCodexRollout(home, dateStr, lines) {
1026 // Layout mirrors what `~/.codex/sessions/` actually contains:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected