UNPKG

navy

Version:

Quick and powerful development environments using Docker and Docker Compose

30 lines (25 loc) 799 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.execAsync = execAsync; var _child_process = require("child_process"); const debug = require('debug')('navy:exec'); function execAsync(command, args = [], callback, opts) { return new Promise((resolve, reject) => { const cmd = command + ' ' + args.join(' '); debug('Executing ' + cmd); const childProcess = (0, _child_process.exec)(cmd, opts, (err, stdout, stderr) => { if (err) { reject(err); } else { resolve(stdout.toString()); } }); childProcess.stdout.on('data', line => debug('out: ' + line.toString())); childProcess.stderr.on('data', line => debug('err: ' + line.toString())); if (callback) { callback(childProcess); } }); }