UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

35 lines (31 loc) 889 B
'use strict'; var child_process = require('child_process'); function execCommand(command, args = [], options = {}) { return new Promise((resolve, reject) => { const child = child_process.spawn(command, args, { ...options, shell: true }); let stdout = ""; let stderr = ""; if (child.stdout) { child.stdout.on("data", (data) => { stdout += data.toString(); }); } if (child.stderr) { child.stderr.on("data", (data) => { stderr += data.toString(); }); } child.on("close", (code) => { if (code === 0) { resolve({ stdout, stderr, exitCode: code || 0 }); } else { reject(new Error(`Process exited with code ${code}: ${stderr}`)); } }); child.on("error", (err) => { reject(err); }); }); } exports.execCommand = execCommand; //# sourceMappingURL=exec-command.cjs.map