History

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.

Cursor Agent committed 7 months ago

Commit 82b82601 parent 0be82d36 files · +39 −54Browse files

Showing the changes to scripts (1 of 6 files). Show all

Unified · Split

scripts/open-perf-app.ts+1−1
@@ -208,7 +208,7 @@ async function seedPerfState(scenarioId: PerfSeedScenarioId): Promise<PerfSeeded · 207 unmodified lines
208 stderr += chunk.toString();208 stderr += chunk.toString();
209 });209 });
210 210
211 const [exitCode] = (await once(seedProcess, "exit")) as [number | null];211 const [exitCode] = (await once(seedProcess, "close")) as [number | null];
212 if (exitCode !== 0) {212 if (exitCode !== 0) {
213 throw new Error(`Perf seed command failed with code ${exitCode ?? "unknown"}.\n${stderr}`);213 throw new Error(`Perf seed command failed with code ${exitCode ?? "unknown"}.\n${stderr}`);
214 }214 }