Skip to content

Commit 2275baf

Browse files
committed
stop loadtest if server exits
1 parent 636918c commit 2275baf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

internal/perf/src/loadtest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function loadtest(opts: LoadtestOptions) {
8585
}
8686
})();
8787

88-
await waitForExit;
88+
await Promise.race([waitForExit, server.waitForExit]);
8989

9090
return { memoryInMBSnapshots };
9191
}

internal/proc/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { fetch } from '@whatwg-node/fetch';
99
import terminate from 'terminate/promise';
1010

1111
export interface Proc extends AsyncDisposable {
12+
waitForExit: Promise<void>;
1213
getStd(o: 'out' | 'err' | 'both'): string;
1314
getStats(): Promise<{
1415
// Total CPU utilization (of all cores) as a percentage.
@@ -84,6 +85,7 @@ export function spawn(
8485
let stderr = '';
8586
let stdboth = '';
8687
const proc: Proc = {
88+
waitForExit,
8789
getStd(o) {
8890
switch (o) {
8991
case 'out':

0 commit comments

Comments
 (0)