Code coverage report for yeoman-generator/lib/actions/spawn_command.js

Statements: 100% (8 / 8)      Branches: 50% (3 / 6)      Functions: 100% (1 / 1)      Lines: 100% (8 / 8)      Ignored: none     

All files » yeoman-generator/lib/actions/ » spawn_command.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  1 1 1                 1 1 1 1   1    
'use strict';
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
 */
 
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));
};