import { spawn } from "child_process"; export default function simpleSpawn(cmd: string, arg: string[]) { const process = spawn(cmd, arg); let output = ""; let err = ""; return new Promise((resolve, reject) => { process.on("close", (code) => { code === 0 ? resolve(output) : reject(err); }); process.stdout.on("data", (data) => (output += data.toString("utf-8"))); process.stderr.on("data", (data) => (err += data.toString("utf-8"))); }); }