everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
28 lines (26 loc) • 656 B
JavaScript
import { execa } from "execa";
//#region src/utils/run.ts
async function run(cmd, args, options = {}) {
const proc = await execa(cmd, args, {
cwd: options.cwd,
env: options.env ? {
...process.env,
...options.env
} : process.env,
stdio: options.capture ? "pipe" : "inherit",
reject: false
});
if (!options.capture) {
const exitCode = proc.exitCode ?? 0;
if (exitCode !== 0) throw new Error(`${cmd} ${args.join(" ")} failed with exit code ${exitCode}`);
return;
}
return {
stdout: proc.stdout ?? "",
stderr: proc.stderr ?? "",
exitCode: proc.exitCode ?? 0
};
}
//#endregion
export { run };
//# sourceMappingURL=run.mjs.map