"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.exec = void 0;
const shell = require("node:child_process");
const exec = async (command, args, { cwd = process.cwd(), verbose = false, } = {}) => {
    try {
        return new Promise((resolve, reject) => {
            const process = shell.spawn(command, args, { cwd });
            process.stdout.on('data', data => verbose && console.log(`${data}`));
            process.stderr.on('data', data => verbose && console.error(`${data}`));
            process.on('error', err => reject(err));
            process.on('close', code => resolve(code));
        });
    }
    catch (error) {
        console.error(error);
    }
};
exports.exec = exec;
