woocommerce/plugins/woocommerce-blocks/tests/e2e-pw/utils/cli.ts

18 lines
343 B
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { exec } from 'child_process';
export function cli( cmd, args = [] ) {
return new Promise( ( resolve ) => {
exec( `${ cmd } ${ args.join( ' ' ) }`, ( error, stdout, stderr ) => {
resolve( {
code: error && error.code ? error.code : 0,
error,
stdout,
stderr,
} );
} );
} );
}