MCPcopy Create free account
hub / github.com/modem-dev/hunk / runScript

Function runScript

benchmarks/run.ts:123–147  ·  view source on GitHub ↗
(script: string)

Source from the content-addressed store, hash-verified

121}
122
123async function runScript(script: string) {
124 const proc = Bun.spawn(["bun", "run", `benchmarks/${script}`], {
125 stdout: "pipe",
126 stderr: "pipe",
127 stdin: "ignore",
128 env: { ...process.env, CI: process.env.CI ?? "1" },
129 });
130
131 const [stdout, stderr, exitCode] = await Promise.all([
132 new Response(proc.stdout).text(),
133 new Response(proc.stderr).text(),
134 proc.exited,
135 ]);
136
137 if (stderr.trim()) {
138 console.warn(stderr.trim());
139 }
140
141 if (exitCode !== 0) {
142 throw new Error(`${script} failed with exit code ${exitCode}\n${stderr}`);
143 }
144
145 process.stdout.write(stdout);
146 return parseMetrics(stdout);
147}
148
149function formatValue(value: number) {
150 if (Math.abs(value) >= 100) {

Callers 1

run.tsFile · 0.85

Calls 2

parseMetricsFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected