Skip to content

Commit 0610842

Browse files
committed
fix: missing buffer
1 parent 1cd0d76 commit 0610842

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.github/workflows/benchmark.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths:
77
- 'src/**'
88
- 'reports/**'
9+
- 'samples/**'
910
- '.github/workflows/benchmark.yaml'
1011
- 'package.json'
1112

reports/benchmark_plotter.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self, benchmarks: pd.DataFrame, dir: str):
2525
{"name": "Types", "unit": "Count"},
2626
{"name": "Symbols", "unit": "Count"},
2727
{"name": "I/O Read time", "unit": "Seconds"},
28+
{"name": "Files", "unit": "Count"},
2829
]
2930

3031
def plot(self):

reports/benchmark_reader.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, dir: str):
2121
"Symbols",
2222
"I/O Write time",
2323
"I/O Read time",
24+
"Files"
2425
]
2526
self.benchmarks = self._buildBenchmarks(self.metrics, self.files)
2627

src/cli/evaluate.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,28 @@ import { BENCHMARK_DIR_NAME, GENERATED_DIR_NAME } from '@/constants/path'
33
import { cleanDir } from '@/utils/clean-dir'
44
import { extractFileName } from '@/utils/extract-file-name'
55
import { writeFile } from '@/utils/write-file'
6+
import { Chunk } from '@effect/schema/Schema'
67
import { spawn } from 'child_process'
78
import * as fs from 'node:fs'
89
import * as path from 'node:path'
910

1011
async function spawnProcess(command: string, args: string[], onStdout?: (chunk: Buffer) => void) {
1112
console.log('Running command:', '\x1b[36m%s\x1b[0m', command, args.join(' '))
1213

14+
let buffer = Buffer.from('')
15+
1316
return new Promise<void>((resolve, reject) => {
1417
const proc = spawn(command, args)
15-
if (onStdout) proc.stdout.on('data', onStdout)
18+
if (onStdout)
19+
proc.stdout.on('data', (chunk) => {
20+
buffer = Buffer.concat([buffer, chunk])
21+
})
1622
else proc.stdout.pipe(process.stdout)
1723

1824
proc.stderr.pipe(process.stderr)
1925
proc.on('close', (code) => {
2026
if (code === 0) {
27+
onStdout?.(buffer)
2128
resolve()
2229
} else {
2330
reject(code)
@@ -50,7 +57,7 @@ async function evaluate(attempt: number, options?: { enableTracing?: boolean })
5057
`pnpm`,
5158
['tsc', '--noEmit', '--skipLibCheck', '--extendedDiagnostics', ...traceOptions, srcPath],
5259
(content) => {
53-
const contentString = content.toString()
60+
const contentString = content.toString('utf-8')
5461
writeFile(destPath, contentString)
5562
}
5663
)

0 commit comments

Comments
 (0)