@@ -3,15 +3,19 @@ import { execSync } from 'node:child_process';
33import { createCliCommand } from '../internal/cli.js' ;
44import { normalizeContext } from '../internal/context.js' ;
55import type { AutorunCommandExecutorOptions } from './schema.js' ;
6- import { mergeExecutorOptions , parseAutorunExecutorOptions } from './utils.js' ;
6+ import {
7+ mergeExecutorOptions ,
8+ objectToCliArgs ,
9+ parseAutorunExecutorOptions ,
10+ } from './utils.js' ;
711
812export type ExecutorOutput = {
913 success : boolean ;
1014 command ?: string ;
1115 error ?: Error ;
1216} ;
1317
14- export default function runAutorunExecutor (
18+ export default async function runAutorunExecutor (
1519 terminalAndExecutorOptions : AutorunCommandExecutorOptions ,
1620 context : ExecutorContext ,
1721) : Promise < ExecutorOutput > {
@@ -36,9 +40,20 @@ export default function runAutorunExecutor(
3640 logger . warn ( `DryRun execution of: ${ commandString } ` ) ;
3741 } else {
3842 try {
39- // @TODO use executeProcess instead of execSync -> non blocking, logs #761
40- // eslint-disable-next-line n/no-sync
41- execSync ( commandString , commandStringOptions ) ;
43+ const { executeProcess } : typeof import ( '@code-pushup/utils' ) =
44+ await import ( '@code-pushup/utils' ) ;
45+ await executeProcess ( {
46+ command : command ,
47+ args : objectToCliArgs ( cliArgumentObject ) ,
48+ observer : {
49+ error : data => {
50+ process . stderr . write ( data ) ;
51+ } ,
52+ next : data => {
53+ process . stdout . write ( data ) ;
54+ } ,
55+ } ,
56+ } ) ;
4257 } catch ( error ) {
4358 logger . error ( error ) ;
4459 return Promise . resolve ( {
0 commit comments