(sessionPath: string)
| 61 | } |
| 62 | |
| 63 | function runImport(sessionPath: string): { stdout: string; stderr: string; status: number } { |
| 64 | const env: Record<string, string> = {}; |
| 65 | for (const [k, v] of Object.entries(process.env)) { |
| 66 | if (v !== undefined) env[k] = v; |
| 67 | } |
| 68 | env.GSTACK_STATE_ROOT = stateRoot; |
| 69 | env.GSTACK_QUESTION_LOG_NO_DERIVE = '1'; |
| 70 | delete env.GSTACK_HOME; |
| 71 | const res = spawnSync(BIN, [sessionPath], { env, encoding: 'utf-8', cwd: ROOT }); |
| 72 | return { |
| 73 | stdout: res.stdout ?? '', |
| 74 | stderr: res.stderr ?? '', |
| 75 | status: res.status ?? -1, |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | function readImportedEvents(): Array<Record<string, unknown>> { |
| 80 | const f = path.join(stateRoot, 'projects', cwdSlug, 'question-log.jsonl'); |
no test coverage detected