woocommerce/plugins/woocommerce-blocks/tests/utils/run-cli-from-test.js

18 lines
343 B
JavaScript
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,
} );
} );
} );
}