UNPKG

@supernovaio/cli

Version:

Supernova.io Command Line Interface

30 lines (28 loc) 1.25 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="de0d9c35-946a-520a-ad28-94ff83e90fb8")}catch(e){}}(); import { spawn } from "node:child_process"; export async function spawnAndWait(command, args, options = {}) { await new Promise((resolve, reject) => { const child = spawn(command, args, { cwd: options.cwd, env: options.env ?? process.env, stdio: ["pipe", "inherit", "inherit"], }); child.once("error", error => reject(error)); child.once("close", code => { if (code === 0) { resolve(); } else { reject(new Error(`Command failed (${code ?? "unknown"}): ${command} ${args.join(" ")}`)); } }); if (child.stdin) { if (options.stdinData !== undefined) { child.stdin.write(options.stdinData); } child.stdin.end(); } }); } //# sourceMappingURL=spawn-and-wait.js.map //# debugId=de0d9c35-946a-520a-ad28-94ff83e90fb8