fix: use 'close' event for seed process and deduplicate buildPerfServerEnv

- Change once(seedProcess, 'exit') to once(seedProcess, 'close') in
  appHarness.ts and open-perf-app.ts to ensure piped stdio buffers are
  fully drained before parsing stdout.

- Extract buildPerfServerEnv into @t3tools/shared/perf/serverEnv to
  eliminate identical copies in serverPerfHarness.ts and web serverEnv.ts.
  Both consumers now import from the shared module.
This commit is contained in:
Cursor Agent committed 2026-04-02 15:33:56 +00:00
1 parent 0be82d3443
commit 82b826072f
6 files changed
+39 -54

No files matched your search

+1 -1
View File
@@ -208,7 +208,7 @@ async function seedPerfState(scenarioId: PerfSeedScenarioId): Promise<PerfSeeded
stderr += chunk.toString();
});
const [exitCode] = (await once(seedProcess, "exit")) as [number | null];
const [exitCode] = (await once(seedProcess, "close")) as [number | null];
if (exitCode !== 0) {
throw new Error(`Perf seed command failed with code ${exitCode ?? "unknown"}.\n${stderr}`);
}