Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function invoke(namespace, options, cb) {
cb = cb || function () {};
options = options || {};
options.args = options.args || [];
// Hack: create a clone of the environment because we don't want to share
// the runLoop
var env = require('yeoman-environment').util.duplicateEnv(this.env);
var generator = env.create(namespace, options);
this.log.emit('up');
this.log.invoke(namespace);
this.log.emit('up');
generator.once('end', function () {
this.log.emit('down');
this.log.emit('down');
}.bind(this));
return generator.run(cb);
};