yeoman-generator
Version:
Rails-inspired generator system that provides scaffolding for your apps
23 lines (19 loc) • 547 B
JavaScript
;
var _ = require('lodash');
var spawn = require('child_process').spawn;
var win32 = process.platform === 'win32';
/**
* Normalize a command across OS and spawn it.
*
* @param {String} command
* @param {Array} args
*
* @mixin
* @alias actions/spawn_command
*/
module.exports = function spawnCommand(command, args, opt) {
var winCommand = win32 ? 'cmd' : command;
var winArgs = win32 ? ['/c'].concat(command, args) : args;
opt = opt || {};
return spawn(winCommand, winArgs, _.defaults({ stdio: 'inherit' }, opt));
};