Skip to content

Commit c0dd75b

Browse files
ibolmoposens
andauthored
Use spawn to address buffer size limitation issue (#84)
Co-authored-by: Son Thanh Nguyen <thanhson92@gmail.com>
1 parent 47bfcfa commit c0dd75b

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

eval/dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eval/dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eval/src/braintrust.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from "path";
22
import * as core from "@actions/core";
3-
import { exec as execSync } from "child_process";
3+
import { spawn } from "child_process";
44

55
import { Params } from "./main";
66
import { ExperimentSummary } from "braintrust";
@@ -19,11 +19,12 @@ function snakeToCamelCase(str: string) {
1919
async function runCommand(command: string, onSummary: OnSummaryFn) {
2020
core.info(`> $ ${command}`);
2121
return new Promise((resolve, reject) => {
22-
const process = execSync(command);
22+
const process = spawn(command, { shell: true });
2323

24-
process.stdout?.on("data", (text: string) => {
24+
process.stdout?.on("data", (data: Buffer) => {
2525
onSummary(
26-
text
26+
data
27+
.toString()
2728
.split("\n")
2829
.map(line => line.trim())
2930
.filter(line => line.length > 0)
@@ -46,8 +47,8 @@ async function runCommand(command: string, onSummary: OnSummaryFn) {
4647
);
4748
});
4849

49-
process.stderr?.on("data", data => {
50-
core.info(data); // Outputs the stderr of the command
50+
process.stderr?.on("data", (data: Buffer) => {
51+
core.info(data.toString()); // Outputs the stderr of the command
5152
});
5253

5354
process.on("close", code => {

0 commit comments

Comments
 (0)