11import path from "path" ;
22import * as core from "@actions/core" ;
3- import { exec as execSync } from "child_process" ;
3+ import { spawn } from "child_process" ;
44
55import { Params } from "./main" ;
66import { ExperimentSummary } from "braintrust" ;
@@ -19,11 +19,12 @@ function snakeToCamelCase(str: string) {
1919async 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