export function executeCmd()

in generator/utils.ts [10:32]


export function executeCmd(cwd: string, cmd: string, args: string[]) : Promise<number> {
    return new Promise((resolve, reject) => {
        console.log(`[${cwd}] executing: ${cmd} ${args.join(' ')}`);

        const child = spawn(cmd, args, {
            cwd: cwd,
            windowsHide: true,
            shell: true,
        });

        child.stdout.on('data', data => process.stdout.write(colors.grey(data.toString())));
        child.stderr.on('data', data => process.stdout.write(colors.red(data.toString())));
        child.on('error', err => {
            reject(err);
        });
        child.on('exit', code => {
            if (code !== 0) {
                reject(`Exited with code ${code}`);
            }
            resolve(code ? code : 0);
        });
    });
}